finalmask.test.ts 890 B

1234567891011121314151617181920212223242526
  1. /// <reference types="vite/client" />
  2. import { describe, expect, it } from 'vitest';
  3. import { FinalMaskStreamSettingsSchema } from '@/schemas/protocols/stream';
  4. const fixtures = import.meta.glob<unknown>(
  5. './golden/fixtures/finalmask/*.json',
  6. { eager: true, import: 'default' },
  7. );
  8. function fixtureName(path: string): string {
  9. const file = path.split('/').pop() ?? path;
  10. return file.replace(/\.json$/, '');
  11. }
  12. describe('FinalMaskStreamSettingsSchema fixtures', () => {
  13. const entries = Object.entries(fixtures).sort(([a], [b]) => a.localeCompare(b));
  14. expect(entries.length, 'expected at least one fixture under golden/fixtures/finalmask').toBeGreaterThan(0);
  15. for (const [path, raw] of entries) {
  16. it(`parses ${fixtureName(path)} byte-stably`, () => {
  17. const parsed = FinalMaskStreamSettingsSchema.parse(raw);
  18. expect(parsed).toMatchSnapshot();
  19. });
  20. }
  21. });