chore: add test type declarations
This commit is contained in:
parent
72a88068b9
commit
08c699dbc1
24
src/types/test-globals.d.ts
vendored
Normal file
24
src/types/test-globals.d.ts
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
declare global {
|
||||||
|
const describe: (name: string, fn: () => void) => void
|
||||||
|
const test: (name: string, fn: () => void | Promise<void>) => void
|
||||||
|
const beforeEach: (fn: () => void | Promise<void>) => void
|
||||||
|
const afterEach: (fn: () => void | Promise<void>) => void
|
||||||
|
const expect: (value: unknown) => {
|
||||||
|
toBe: (expected: unknown) => void
|
||||||
|
toContain: (expected: unknown) => void
|
||||||
|
not: {
|
||||||
|
toBe: (expected: unknown) => void
|
||||||
|
toContain: (expected: unknown) => void
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const spyOn: <T extends object, K extends keyof T>(
|
||||||
|
target: T,
|
||||||
|
key: K
|
||||||
|
) => {
|
||||||
|
mockReturnValue: (value: T[K]) => void
|
||||||
|
mockImplementation: (impl: T[K]) => void
|
||||||
|
mockRestore: () => void
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export {}
|
||||||
Loading…
x
Reference in New Issue
Block a user