File
Blob: worker/tests/runtime/setup.ts
| 1 | import { afterEach, beforeEach, expect, vi } from 'vitest'; |
| 2 | import { reset } from 'cloudflare:test'; |
| 3 | import { env } from 'cloudflare:workers'; |
| 4 | import { bindings } from '@tests/helpers/sfu-fixture.ts'; |
| 5 | |
| 6 | beforeEach(() => { |
| 7 | for (const [key, value] of Object.entries(bindings)) |
| 8 | expect(env[key as keyof typeof bindings]).toBe(value); |
| 9 | vi.stubGlobal('fetch', () => { |
| 10 | throw new Error('This test has no outbound SFU fixture'); |
| 11 | }); |
| 12 | }); |
| 13 | afterEach(async () => { |
| 14 | vi.useRealTimers(); |
| 15 | await reset(); |
| 16 | vi.restoreAllMocks(); |
| 17 | vi.unstubAllGlobals(); |
| 18 | }); |