Removes forceHttps flag

This commit is contained in:
Akshay Nair committed 2020-10-05 01:00:21 +05:30
1 parent 12010f3007
commit 4844a7bbe1
6 files changed
+6 -37

No files matched your search

-1
View File
@@ -5,7 +5,6 @@
"username": "phenax",
"email": "phenax5@gmail.com"
},
"forceHttps": true,
"record": {
"CNAME": "phenax.github.io"
}
-1
View File
@@ -4,7 +4,6 @@
"username": "phenax",
"email": "phenax5@gmail.com"
},
"forceHttps": true,
"record": {
"CNAME": "duckduckgo.com"
}
+2 -6
View File
@@ -1,5 +1,5 @@
const R = require('ramda');
const { VALID_RECORD_TYPES, NC_DOMAIN, TTL } = require('../utils/constants');
const { VALID_RECORD_TYPES, TTL } = require('../utils/constants');
const { domainService: domain } = require('../utils/domain-service');
const { getDomains } = require('../utils/domain');
@@ -8,7 +8,7 @@ const getRecords = R.compose(R.toPairs, R.pick(VALID_RECORD_TYPES));
const toHostList = R.chain(data => {
const rs = getRecords(data.record);
const records = R.chain(([recordType, urls]) =>
return R.chain(([recordType, urls]) =>
(Array.isArray(urls) ? urls : [urls]).map(url => ({
HostName: data.name,
RecordType: recordType,
@@ -16,10 +16,6 @@ const toHostList = R.chain(data => {
TTL,
}))
, rs);
return !data.forceHttps ? records : records.concat([
{ HostName: data.name, RecordType: 'URL', Address: `https://${data.name}.${NC_DOMAIN}` },
]);
});
const registerDomains = async ({ domainService, getDomains }) => {
-3
View File
@@ -9,7 +9,6 @@ describe('getDomains', () => {
const defaultDomain = {
name: 'aaa',
forceHttps: false,
record: {
A: ['121.121.121.121']
},
@@ -24,8 +23,6 @@ const getstroflen = len => Array(len).fill('a').join('');
describe('validateDomainData', () => {
const invalidCases = [
{},
{ forceHttps: false },
{ forceHttps: 1 },
{ name: 'helo' },
{ name: 'wwow', record: { A: ['12312'] } },
...['', ' ', undefined, 'hlo wld', 'g32++13', 'ajsdD_123yq', 'khsda%', '122*dsd', getstroflen(101)].map(name => ({
+4 -22
View File
@@ -1,12 +1,12 @@
const { toHostList } = require('../scripts/register-domains');
const { NC_DOMAIN, TTL } = require('../utils/constants');
const { 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: 'xx', forceHttps: false, record: { A: ['1.2.3.4', '5.6.3.2', '1.2.31.1'] } },
{ name: 'akshay', record: { CNAME: 'phenax.github.io' } },
{ name: 'foobar', record: { CNAME: 'v.io' } },
{ name: 'xx', record: { A: ['1.2.3.4', '5.6.3.2', '1.2.31.1'] } },
]);
expect(res).toEqual([
@@ -17,22 +17,4 @@ describe('toHostList', () => {
{ HostName: 'xx', RecordType: 'A', Address: '1.2.31.1', TTL },
]);
});
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: 'xx', forceHttps: true, record: { A: ['1.2.3.4', '5.6.3.2', '1.2.31.1'] } },
]);
expect(res).toEqual([
{ HostName: 'akshay', RecordType: 'CNAME', Address: 'phenax.github.io', TTL },
{ HostName: 'akshay', RecordType: 'URL', Address: `https://akshay.${NC_DOMAIN}` },
{ HostName: 'foobar', RecordType: 'CNAME', Address: 'v.io', TTL },
{ HostName: 'xx', RecordType: 'A', Address: '1.2.3.4', TTL },
{ HostName: 'xx', RecordType: 'A', Address: '5.6.3.2', TTL },
{ HostName: 'xx', RecordType: 'A', Address: '1.2.31.1', TTL },
{ HostName: 'xx', RecordType: 'URL', Address: `https://xx.${NC_DOMAIN}` },
]);
});
});
-4
View File
@@ -52,10 +52,6 @@ const validateDomainData = validate({
}),
]),
},
forceHttps: {
reason: '`forceHttp` is required to be true or false',
fn: R.is(Boolean),
},
record: {
reason: 'Invalid record',
fn: R.allPass([