Adds name validation

This commit is contained in:
Akshay Nair committed 2020-10-04 13:30:15 +05:30
1 parent 5e20f5ea74
commit e042b69b2a
2 files changed
+16 -5

No files matched your search

+12 -1
View File
@@ -10,9 +10,20 @@ describe('Domains', () => {
});
});
describe('isValidDomainData', () => {
describe('validateDomainData', () => {
it('should return true if the name is invalid', () => {
const { valid, errors } = validateDomainData({
name: 'hello world',
forceHttps: true,
record: { CNAME: ['hello.com'] },
});
expect(valid).toBe(false);
expect(errors[0][0]).toBe('name');
});
it('should return true for a valid object', () => {
const { valid, errors } = validateDomainData({
name: 'something',
forceHttps: true,
record: { CNAME: ['hello.com'] },
});