dns-presets.test.ts 836 B

12345678910111213141516171819
  1. import { describe, expect, it } from 'vitest';
  2. import { PRESETS } from '@/pages/xray/dns/DnsPresetsModal';
  3. import { DnsObjectSchema, DnsServerObjectSchema } from '@/schemas/dns';
  4. describe('DNS presets', () => {
  5. it('include encrypted presets accepted by xray DNS config', () => {
  6. const servers = PRESETS.flatMap((preset) => preset.data);
  7. expect(servers).toContain('https://freedns.controld.com/p2');
  8. expect(servers).toContain('quic+local://p2.freedns.controld.com');
  9. expect(servers).toContain('https://dns.google/dns-query');
  10. expect(servers.every((server) => !server.startsWith('tls://'))).toBe(true);
  11. expect(DnsObjectSchema.parse({ servers }).servers).toEqual(servers);
  12. for (const server of servers) {
  13. expect(DnsServerObjectSchema.parse({ address: server }).address).toBe(server);
  14. }
  15. });
  16. });