0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 12:21:02 +01:00
posthog/tests/helpers/sqlMock.ts
2020-12-07 15:40:09 +01:00

13 lines
728 B
TypeScript

import * as s from '../../src/sql'
// mock functions that get data from postgres and give them the right types
type UnPromisify<F> = F extends (...args: infer A) => Promise<infer T> ? (...args: A) => T : never
export const getPluginRows = (s.getPluginRows as unknown) as jest.MockedFunction<UnPromisify<typeof s.getPluginRows>>
export const getPluginAttachmentRows = (s.getPluginAttachmentRows as unknown) as jest.MockedFunction<
UnPromisify<typeof s.getPluginAttachmentRows>
>
export const getPluginConfigRows = (s.getPluginConfigRows as unknown) as jest.MockedFunction<
UnPromisify<typeof s.getPluginConfigRows>
>
export const setError = (s.setError as unknown) as jest.MockedFunction<UnPromisify<typeof s.setError>>