Skip to content

Commit 8030c55

Browse files
committed
test: fix ci for download regression coverage
1 parent 472e1e8 commit 8030c55

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

convex/downloads.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const okRate = () => ({
2424
describe('downloads helpers', () => {
2525
afterEach(() => {
2626
vi.unstubAllEnvs()
27+
vi.unstubAllGlobals()
2728
})
2829

2930
it('calculates hour start boundaries', () => {
@@ -62,6 +63,17 @@ describe('downloads helpers', () => {
6263
})
6364

6465
it('records zip downloads through the internal mutation path', async () => {
66+
class MockResponse {
67+
status: number
68+
headers: Headers
69+
70+
constructor(_body?: BodyInit | null, init?: ResponseInit) {
71+
this.status = init?.status ?? 200
72+
this.headers = new Headers(init?.headers)
73+
}
74+
}
75+
vi.stubGlobal('Response', MockResponse as unknown as typeof Response)
76+
6577
const runQuery = vi.fn(async (_query: unknown, args: Record<string, unknown>) => {
6678
if (isRateLimitArgs(args)) return okRate()
6779
if ('slug' in args) {

vitest.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export default defineConfig({
99
hookTimeout: 15_000,
1010
exclude: [
1111
'**/node_modules/**',
12+
'**/.output/**',
13+
'**/.nitro/**',
1214
'**/dist/**',
1315
'**/coverage/**',
1416
'**/convex/_generated/**',
@@ -35,6 +37,8 @@ export default defineConfig({
3537
],
3638
exclude: [
3739
'node_modules/',
40+
'.output/',
41+
'.nitro/',
3842
'dist/',
3943
'coverage/',
4044
'convex/_generated/',

0 commit comments

Comments
 (0)