UNPKG

@knowark/validarkjs

Version:
122 lines (121 loc) 4.05 kB
[ { "description": "validation of e-mail addresses", "schema": { "$schema": "https://json-schema.org/draft/2020-12/schema", "format": "email" }, "tests": [ { "description": "all string formats ignore integers", "data": 12, "valid": true }, { "description": "all string formats ignore floats", "data": 13.7, "valid": true }, { "description": "all string formats ignore objects", "data": {}, "valid": true }, { "description": "all string formats ignore arrays", "data": [], "valid": true }, { "description": "all string formats ignore booleans", "data": false, "valid": true }, { "description": "all string formats ignore nulls", "data": null, "valid": true }, { "description": "a valid e-mail address", "data": "joe.bloggs@example.com", "valid": true }, { "description": "an invalid e-mail address", "data": "2962", "valid": false }, { "description": "tilde in local part is valid", "data": "te~st@example.com", "valid": true }, { "description": "tilde before local part is valid", "data": "~test@example.com", "valid": true }, { "description": "tilde after local part is valid", "data": "test~@example.com", "valid": true }, { "description": "a quoted string with a space in the local part is valid", "data": "\"joe bloggs\"@example.com", "valid": true }, { "description": "a quoted string with a double dot in the local part is valid", "data": "\"joe..bloggs\"@example.com", "valid": true }, { "description": "a quoted string with a @ in the local part is valid", "data": "\"joe@bloggs\"@example.com", "valid": true }, { "description": "an IPv4-address-literal after the @ is valid", "data": "joe.bloggs@[127.0.0.1]", "valid": true }, { "description": "an IPv6-address-literal after the @ is valid", "data": "joe.bloggs@[IPv6:::1]", "valid": true }, { "description": "dot before local part is not valid", "data": ".test@example.com", "valid": false }, { "description": "dot after local part is not valid", "data": "test.@example.com", "valid": false }, { "description": "two separated dots inside local part are valid", "data": "te.s.t@example.com", "valid": true }, { "description": "two subsequent dots inside local part are not valid", "data": "te..st@example.com", "valid": false }, { "description": "an invalid domain", "data": "joe.bloggs@invalid=domain.com", "valid": false }, { "description": "an invalid IPv4-address-literal", "data": "joe.bloggs@[127.0.0.300]", "valid": false } ] } ]