Blocks invalid record types

This commit is contained in:
Akshay Nair
2020-10-05 00:57:34 +05:30
parent 5c7612d568
commit 12010f3007
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ describe('validateDomainData', () => {
name,
})),
{ ...defaultDomain, record: { CNAME: 'sd', A: ['121,3213'] } },
//{ ...defaultDomain, record: { FOOBAR: ['sd'] } },
{ ...defaultDomain, record: { A: ['121', '12'], FOOBAR: ['sd'] } },
{ ...defaultDomain, owner: {}, },
{ ...defaultDomain, owner: { username: 'hwelo', }, },
{ ...defaultDomain, owner: { email: 'hwelo' }, },
+2 -1
View File
@@ -1,6 +1,7 @@
const fs = require('fs');
const path = require('path');
const R = require('ramda');
const { VALID_RECORD_TYPES } = require('./constants');
const DOMAINS_PATH = path.resolve('domains');
@@ -59,7 +60,7 @@ const validateDomainData = validate({
reason: 'Invalid record',
fn: R.allPass([
R.is(Object),
//r => R.keys(r).
R.compose(R.isEmpty, R.flip(R.difference)(VALID_RECORD_TYPES), R.keys),
R.cond([
[R.prop('CNAME'), validateNameRecord('CNAME')],
[R.prop('ALIAS'), validateNameRecord('ALIAS')],