mirror of
https://github.com/itdoginfo/podkop.git
synced 2026-06-24 03:13:11 +03:00
fix: allow .tld for user_domains_text & user_domains
This commit is contained in:
@@ -29,6 +29,13 @@ export const invalidDomains = [
|
||||
['Too long domain (>253 chars)', Array(40).fill('abcdef').join('.') + '.com'],
|
||||
];
|
||||
|
||||
export const dotTLDTests = [
|
||||
['Dot TLD allowed (.net)', '.net', true, true],
|
||||
['Dot TLD not allowed (.net)', '.net', false, false],
|
||||
['Invalid with double dot', '..net', true, false],
|
||||
['Invalid single word TLD (net)', 'net', true, false],
|
||||
];
|
||||
|
||||
describe('validateDomain', () => {
|
||||
describe.each(validDomains)('Valid domain: %s', (_desc, domain) => {
|
||||
it(`returns valid=true for "${domain}"`, () => {
|
||||
@@ -43,4 +50,14 @@ describe('validateDomain', () => {
|
||||
expect(res.valid).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe.each(dotTLDTests)(
|
||||
'Dot TLD toggle: %s',
|
||||
(_desc, domain, allowDotTLD, expected) => {
|
||||
it(`"${domain}" with allowDotTLD=${allowDotTLD} → valid=${expected}`, () => {
|
||||
const res = validateDomain(domain, allowDotTLD);
|
||||
expect(res.valid).toBe(expected);
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user