validations: removes unnecessary validation

This commit is contained in:
Akshay Nair
2021-09-07 22:21:19 +05:30
parent a6e5bf5145
commit 0e48ab5b1e
2 changed files with 0 additions and 7 deletions
-1
View File
@@ -45,7 +45,6 @@ describe('validateDomainData', () => {
{ ...defaultDomain, record: { CNAME: 'sd', A: ['121,3213'] } },
{ ...defaultDomain, record: { A: ['121', '12'], FOOBAR: ['sd'] } },
{ ...defaultDomain, record: { A: [] } },
{ ...defaultDomain, record: { A: ['11122'], URL: 'foobar' } },
{ ...defaultDomain, owner: {}, },
{ ...defaultDomain, owner: { username: 'hwelo', }, },
{ ...defaultDomain, owner: { email: 'hwelo' }, },
-6
View File
@@ -7,11 +7,6 @@ const isValidURL = and([R.is(String), testRegex(/^https?:\/\//ig)]);
const isValidDomain = and([R.is(String), testRegex(/^(([a-z0-9\-]+)\.)+[a-z]+$/ig)]);
const allowMXRecord = R.compose(
R.ifElse(R.includes('MX'), withLengthEq(2), withLengthEq(1)),
R.keys,
);
const validateCnameRecord = type => and([
R.propIs(String, type),
R.compose(withLengthEq(1), R.keys), // CNAME cannot be used with any other record
@@ -21,7 +16,6 @@ const validateCnameRecord = type => and([
const validateARecord = type => and([
R.propIs(Array, type),
allowMXRecord,
R.propSatisfies(withLengthGte(1), type),
]);