Skip to content

Commit 44a1249

Browse files
committed
fix: test setup with posthog
1 parent 35190bc commit 44a1249

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

frontend/src/test/setup.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
import { GlobalRegistrator } from '@happy-dom/global-registrator'
2-
import { afterEach, expect } from 'bun:test'
2+
import { afterEach, expect, mock } from 'bun:test'
33
import * as matchers from '@testing-library/jest-dom/matchers'
44

55
GlobalRegistrator.register()
66
expect.extend(matchers as Parameters<typeof expect.extend>[0])
77

8+
mock.module('posthog-js', () => ({
9+
default: {
10+
init: mock(),
11+
capture: mock(),
12+
identify: mock(),
13+
reset: mock(),
14+
}
15+
}))
16+
817
// usehooks-ts' `useLocalStorage` dispatches a custom "local-storage" event on
918
// `window` to synchronise multiple hooks of the same key within one window.
1019
// Across tests, hooks from earlier tests linger (React roots aren't unmounted

0 commit comments

Comments
 (0)