Nuxt/packages/test-utils/src/mock.ts
Ricardo Gobbo de Souza b31405f6fd
feat(test-utils): add mockFn and mockLogger utils (#6235)
Co-authored-by: Pooya Parsa <pooya@pi0.io>
2022-09-05 10:51:00 +02:00

17 lines
342 B
TypeScript

import consola from 'consola'
import { useTestContext } from './context'
export function mockFn () {
const ctx = useTestContext()
return ctx.mockFn
}
export function mockLogger (): Record<string, Function> {
const mocks: any = {}
consola.mockTypes((type) => {
mocks[type] = mockFn()
return mocks[type]
})
return mocks
}