0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 04:12:23 +01:00
posthog/plugin-server/tests/helpers/sqlMock.ts
James Greenhill 434e379f9a Add 'plugin-server/' from commit '01a99a4e26b0b11f068a7073d6b94e53a7214d33'
git-subtree-dir: plugin-server
git-subtree-mainline: 776b056b6d
git-subtree-split: 01a99a4e26
2021-10-28 14:59:19 -07:00

17 lines
973 B
TypeScript

import * as s from '../../src/utils/db/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 setPluginCapabilities = s.setPluginCapabilities as unknown as jest.MockedFunction<
UnPromisify<typeof s.setPluginCapabilities>
>
export const setError = s.setError as unknown as jest.MockedFunction<UnPromisify<typeof s.setError>>
export const disablePlugin = s.disablePlugin as unknown as jest.MockedFunction<UnPromisify<void>>