Skip to content
File

Blob: worker/tests/runtime/setup.ts

typescript19 lines
1import { afterEach, beforeEach, expect, vi } from 'vitest';
2import { reset } from 'cloudflare:test';
3import { env } from 'cloudflare:workers';
4import { bindings } from '@tests/helpers/sfu-fixture.ts';
5 
6beforeEach(() => {
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});
13afterEach(async () => {
14 vi.useRealTimers();
15 await reset();
16 vi.restoreAllMocks();
17 vi.unstubAllGlobals();
18});