From 473add5bd879c0f114862f7a214627eaf9b3b88c Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Mon, 5 Oct 2020 00:47:40 +0530 Subject: [PATCH] Changes cname, alias and url records to be single items --- domains/akshay.json | 2 +- domains/test.json | 2 +- tests/domain-utils.test.js | 4 ++-- utils/domain.js | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/domains/akshay.json b/domains/akshay.json index 78c841e964..bd47657b1c 100644 --- a/domains/akshay.json +++ b/domains/akshay.json @@ -7,6 +7,6 @@ }, "forceHttps": true, "record": { - "CNAME": ["phenax.github.io"] + "CNAME": "phenax.github.io" } } diff --git a/domains/test.json b/domains/test.json index 1f8fd91e15..94829c2181 100644 --- a/domains/test.json +++ b/domains/test.json @@ -6,6 +6,6 @@ }, "forceHttps": true, "record": { - "CNAME": ["duckduckgo.com"] + "CNAME": "duckduckgo.com" } } diff --git a/tests/domain-utils.test.js b/tests/domain-utils.test.js index 418f788c72..dabbda53b8 100644 --- a/tests/domain-utils.test.js +++ b/tests/domain-utils.test.js @@ -32,7 +32,7 @@ describe('validateDomainData', () => { ...defaultDomain, name, })), - { ...defaultDomain, record: { CNAME: ['sd'], A: ['121,3213'] } }, + { ...defaultDomain, record: { CNAME: 'sd', A: ['121,3213'] } }, //{ ...defaultDomain, record: { FOOBAR: ['sd'] } }, { ...defaultDomain, owner: {}, }, { ...defaultDomain, owner: { username: 'hwelo', }, }, @@ -49,7 +49,7 @@ describe('validateDomainData', () => { ...defaultDomain, description: getstroflen(99), }, - { ...defaultDomain, record: { CNAME: ['sd'], URL: ['121,3213'] } }, + { ...defaultDomain, record: { CNAME: 'sd', URL: '121,3213' } }, ]; it('should return false for invalid data', () => { diff --git a/utils/domain.js b/utils/domain.js index 15b739204c..ff33ece729 100644 --- a/utils/domain.js +++ b/utils/domain.js @@ -27,7 +27,7 @@ const validate = pattern => data => R.compose( const validateNameRecord = type => R.allPass([ R.compose(R.equals(1), R.length, R.reject(R.equals('URL')), R.keys), - R.propSatisfies(R.is(Array), type), + R.propSatisfies(R.is(String), type), ]); const validateDomainData = validate({ @@ -64,7 +64,7 @@ const validateDomainData = validate({ [R.prop('CNAME'), validateNameRecord('CNAME')], [R.prop('ALIAS'), validateNameRecord('ALIAS')], [R.prop('A'), R.propSatisfies(R.is(Array), 'A')], - [R.prop('URL'), R.propSatisfies(R.is(Array), 'URL')], + [R.prop('URL'), R.propSatisfies(R.is(String), 'URL')], [R.T, R.T], ]), ]),