mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-09-02 20:25:01 +00:00
Adds owner field and fixes tests
This commit is contained in:
@@ -11,6 +11,10 @@ const defaultDomain = {
|
||||
name: 'aaa',
|
||||
forceHttps: false,
|
||||
record: { A: ['121.121.121.121'] },
|
||||
owner: {
|
||||
username: 'betsy',
|
||||
email: 'betsyfuckyoassup@foobar.com',
|
||||
},
|
||||
};
|
||||
|
||||
describe('validateDomainData', () => {
|
||||
@@ -26,10 +30,9 @@ describe('validateDomainData', () => {
|
||||
...defaultDomain,
|
||||
name,
|
||||
})),
|
||||
{
|
||||
...defaultDomain,
|
||||
description: Array(201).fill('a').join(''),
|
||||
},
|
||||
{ ...defaultDomain, owner: {}, },
|
||||
{ ...defaultDomain, owner: { username: 'hwelo', }, },
|
||||
{ ...defaultDomain, owner: { email: 'hwelo' }, },
|
||||
];
|
||||
|
||||
const validCases = [
|
||||
|
||||
+11
-10
@@ -31,18 +31,19 @@ const validateDomainData = validate({
|
||||
str => str && str.match(/^[A-Za-z0-9\-]{2,}$/ig),
|
||||
]),
|
||||
},
|
||||
description: {
|
||||
reason: '`description` has to be shorter than 200 characters',
|
||||
fn: R.anyPass([
|
||||
R.empty,
|
||||
R.is(String),
|
||||
hasLengthLessThan(200),
|
||||
description: { reason: '', fn: R.T, },
|
||||
repo: { reason: '', fn: R.T, },
|
||||
owner: {
|
||||
reason: '`owner` needs username and email properties',
|
||||
fn: R.allPass([
|
||||
R.is(Object),
|
||||
R.complement(R.isEmpty),
|
||||
R.where({
|
||||
username: R.is(String),
|
||||
email: R.is(String),
|
||||
}),
|
||||
]),
|
||||
},
|
||||
repo: {
|
||||
reason: '',
|
||||
fn: R.T,
|
||||
},
|
||||
forceHttps: {
|
||||
reason: '`forceHttp` is required to be true or false',
|
||||
fn: R.is(Boolean),
|
||||
|
||||
Reference in New Issue
Block a user