mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-08-13 06:23:35 +00:00
Blocks invalid record types
This commit is contained in:
@@ -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
@@ -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')],
|
||||
|
||||
Reference in New Issue
Block a user