mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-02 06:56:36 +08:00
d615d85a26
Drop remark fields from Zone, Zone domains, proxy routes, WAF rule groups and IP groups across models, APIs, UI and DB columns (keep certificate/origin remarks). Add quick-create domain input for short labels, @ apex and full FQDNs when binding domains.
29 lines
995 B
TypeScript
29 lines
995 B
TypeScript
import {describe, expect, it} from 'vitest';
|
|
|
|
import {resolveZoneDomainInput} from '@/app/(main)/websites/components/resolve-zone-domain-input';
|
|
|
|
describe('resolveZoneDomainInput', () => {
|
|
it('maps short label and apex @ under zone root', () => {
|
|
expect(resolveZoneDomainInput('api', 'example.com')).toEqual({
|
|
domain: 'api.example.com',
|
|
});
|
|
expect(resolveZoneDomainInput('@', 'example.com')).toEqual({
|
|
domain: 'example.com',
|
|
});
|
|
});
|
|
|
|
it('accepts full FQDN under the zone', () => {
|
|
expect(resolveZoneDomainInput('www.api.example.com', 'example.com')).toEqual({
|
|
domain: 'www.api.example.com',
|
|
});
|
|
expect(resolveZoneDomainInput('example.com', 'example.com')).toEqual({
|
|
domain: 'example.com',
|
|
});
|
|
});
|
|
|
|
it('rejects foreign domains and wildcards', () => {
|
|
expect(resolveZoneDomainInput('evil.com', 'example.com').error).toBeTruthy();
|
|
expect(resolveZoneDomainInput('*.example.com', 'example.com').error).toBeTruthy();
|
|
});
|
|
});
|