inbound-full.test.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. /// <reference types="vite/client" />
  2. import { describe, expect, it } from 'vitest';
  3. import { InboundSchema } from '@/schemas/api/inbound';
  4. // Full Inbound parse tests — exercises the intersection of network DU,
  5. // security DU, settings DU, and orthogonal extras in a single
  6. // round-trip. These fixtures are the input the link generators in
  7. // lib/xray/inbound-link.ts will consume once extracted.
  8. const fixtures = import.meta.glob<unknown>('./golden/fixtures/inbound-full/*.json', {
  9. eager: true,
  10. import: 'default',
  11. });
  12. function fixtureName(path: string): string {
  13. const file = path.split('/').pop() ?? path;
  14. return file.replace(/\.json$/, '');
  15. }
  16. describe('InboundSchema (full) fixtures', () => {
  17. const entries = Object.entries(fixtures).sort(([a], [b]) => a.localeCompare(b));
  18. expect(
  19. entries.length,
  20. 'expected at least one fixture under golden/fixtures/inbound-full',
  21. ).toBeGreaterThan(0);
  22. for (const [path, raw] of entries) {
  23. it(`parses ${fixtureName(path)} byte-stably`, () => {
  24. const parsed = InboundSchema.parse(raw);
  25. expect(parsed).toMatchSnapshot();
  26. });
  27. }
  28. });