mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-08-14 10:25:25 +00:00
validations: removes unnecessary validation
This commit is contained in:
@@ -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' }, },
|
||||
|
||||
@@ -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),
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user