From 5c7612d568a29f85f36138a3ca74e1565e921739 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Mon, 5 Oct 2020 00:52:48 +0530 Subject: [PATCH] Fixes reg script --- scripts/register-domains.js | 2 +- tests/register.test.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/register-domains.js b/scripts/register-domains.js index 8b1771f4f..a8cc7979a 100644 --- a/scripts/register-domains.js +++ b/scripts/register-domains.js @@ -9,7 +9,7 @@ const toHostList = R.chain(data => { const rs = getRecords(data.record); const records = R.chain(([recordType, urls]) => - urls.map(url => ({ + (Array.isArray(urls) ? urls : [urls]).map(url => ({ HostName: data.name, RecordType: recordType, Address: url, diff --git a/tests/register.test.js b/tests/register.test.js index cd4a74551..6c411a3d3 100644 --- a/tests/register.test.js +++ b/tests/register.test.js @@ -4,8 +4,8 @@ const { NC_DOMAIN, TTL } = require('../utils/constants'); describe('toHostList', () => { it('should flatten domain data to list of hosts (without https)', () => { const res = toHostList([ - { name: 'akshay', forceHttps: false, record: { CNAME: ['phenax.github.io'] } }, - { name: 'foobar', forceHttps: false, record: { CNAME: ['v.io'] } }, + { name: 'akshay', forceHttps: false, record: { CNAME: 'phenax.github.io' } }, + { name: 'foobar', forceHttps: false, record: { CNAME: 'v.io' } }, { name: 'xx', forceHttps: false, record: { A: ['1.2.3.4', '5.6.3.2', '1.2.31.1'] } }, ]); @@ -20,8 +20,8 @@ describe('toHostList', () => { it('should flatten domain data to list of hosts (with https)', () => { const res = toHostList([ - { name: 'akshay', forceHttps: true, record: { CNAME: ['phenax.github.io'] } }, - { name: 'foobar', forceHttps: false, record: { CNAME: ['v.io'] } }, + { name: 'akshay', forceHttps: true, record: { CNAME: 'phenax.github.io' } }, + { name: 'foobar', forceHttps: false, record: { CNAME: 'v.io' } }, { name: 'xx', forceHttps: true, record: { A: ['1.2.3.4', '5.6.3.2', '1.2.31.1'] } }, ]);