mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-09-05 08:17:35 +00:00
feat(validation): adds exception for github verification records
This commit is contained in:
@@ -58,6 +58,7 @@ describe('validateDomainData', () => {
|
||||
{ ...defaultDomain, name: 'a.b' },
|
||||
{ ...defaultDomain, name: 'ww2.baa' },
|
||||
{ ...defaultDomain, name: 'help.baa' },
|
||||
{ ...defaultDomain, name: '_github-pages-challenge-is-a-dev' },
|
||||
];
|
||||
|
||||
const validCases = [
|
||||
@@ -78,6 +79,9 @@ describe('validateDomainData', () => {
|
||||
{ ...defaultDomain, record: { A: ['1.1.1.1'], MX: ['mx1.example.com'] } },
|
||||
{ ...defaultDomain, name: 'gogo.foo.bar' },
|
||||
{ ...defaultDomain, name: 'ww9.baa' },
|
||||
{ ...defaultDomain, name: '_github-pages-challenge-phenax.akshay' },
|
||||
{ ...defaultDomain, name: '_github-pages-challenge-hello01-ga' },
|
||||
{ ...defaultDomain, name: '_github-pages-challenge-hello01_ga' },
|
||||
];
|
||||
|
||||
it('should return false for invalid data', () => {
|
||||
|
||||
@@ -11,5 +11,6 @@
|
||||
"ww1",
|
||||
"ww2",
|
||||
"ww3",
|
||||
"ww4"
|
||||
"ww4",
|
||||
"_github-pages-challenge-is-a-dev"
|
||||
]
|
||||
|
||||
+10
-4
@@ -33,10 +33,16 @@ const validateDomainData = validate({
|
||||
and([
|
||||
R.is(String),
|
||||
R.compose(
|
||||
R.all(and([
|
||||
R.compose(between(2, 100), R.length),
|
||||
testRegex(/^[a-z0-9-]+$/g),
|
||||
R.complement(R.includes(R.__, INVALID_NAMES)),
|
||||
R.all(or([
|
||||
and([
|
||||
testRegex(/^_github-pages-challenge-[a-z0-9-_]+$/i), // Exception for github verification records
|
||||
R.complement(R.includes(R.__, INVALID_NAMES)),
|
||||
]),
|
||||
and([
|
||||
R.compose(between(2, 100), R.length),
|
||||
testRegex(/^[a-z0-9-]+$/g),
|
||||
R.complement(R.includes(R.__, INVALID_NAMES)),
|
||||
])
|
||||
])),
|
||||
R.split('.'),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user