inbound-full.test.ts 1.1 KB

12345678910111213141516171819202122232425262728293031
  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>(
  9. './golden/fixtures/inbound-full/*.json',
  10. { eager: true, 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(entries.length, 'expected at least one fixture under golden/fixtures/inbound-full').toBeGreaterThan(0);
  19. for (const [path, raw] of entries) {
  20. it(`parses ${fixtureName(path)} byte-stably`, () => {
  21. const parsed = InboundSchema.parse(raw);
  22. expect(parsed).toMatchSnapshot();
  23. });
  24. }
  25. });