outbounds-testability-gate.test.ts 1.0 KB

1234567891011121314151617181920212223242526
  1. import { describe, expect, it } from 'vitest';
  2. import { isUntestable } from '@/pages/xray/outbounds/outbounds-tab-helpers';
  3. import type { OutboundRow } from '@/pages/xray/outbounds/outbounds-tab-types';
  4. // The row's Test button is disabled by this gate alone: a spelling the core
  5. // resolves but the gate misses reports the panel host's own reachability as a tunnel.
  6. const row = (protocol: string, tag = 'probe'): OutboundRow => ({ key: 0, tag, protocol });
  7. describe('isUntestable', () => {
  8. it.each(['Freedom', 'FREEDOM', 'fReEdOm'])('disables a %s row', (protocol) => {
  9. expect(isUntestable(row(protocol))).toBe(true);
  10. });
  11. it.each(['DNS', 'Dns'])('disables a %s row', (protocol) => {
  12. expect(isUntestable(row(protocol))).toBe(true);
  13. });
  14. it.each(['Blackhole', 'BLACKHOLE', 'Loopback'])('disables a %s row', (protocol) => {
  15. expect(isUntestable(row(protocol))).toBe(true);
  16. });
  17. it.each(['vless', 'VMess', 'Trojan', 'Socks'])('leaves a %s row testable', (protocol) => {
  18. expect(isUntestable(row(protocol))).toBe(false);
  19. });
  20. });