Skip to content

Commit a563a99

Browse files
committed
Update mock in api Sentry test
1 parent b60b7a0 commit a563a99

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎src/pages/api/_sentry/__tests__/index.spec.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
import { describe, it, expect, vi, beforeEach } from 'vitest'
55

66
const sentryInitMock = vi.fn()
7-
const envMocks = {
8-
isProd: vi.fn(),
9-
isDev: vi.fn(),
7+
const envMocks = vi.hoisted(() => ({
8+
isProd: vi.fn(() => false),
9+
isDev: vi.fn(() => false),
1010
getSentryDsn: vi.fn(() => 'https://public@example.ingest.sentry.io/1'),
1111
getPackageRelease: vi.fn(() => 'pkg@1.0.0'),
12-
}
12+
}))
1313

1414
vi.mock('@sentry/astro', () => ({
1515
init: sentryInitMock,
1616
}))
1717

18-
vi.mock('@pages/api/_environment', () => envMocks)
18+
vi.mock('@pages/api/_environment/environmentApi', () => envMocks)
1919

2020
describe('ensureApiSentry', () => {
2121
beforeEach(() => {

0 commit comments

Comments
 (0)