1
0
mirror of https://github.com/uetchy/namae.git synced 2025-03-17 04:30:31 +09:00
namae/api/util/testHelpers.ts

14 lines
321 B
TypeScript
Raw Normal View History

2019-08-30 16:40:22 +09:00
export async function mockProvider(provider: any, query: any) {
2019-08-14 19:55:28 +09:00
const req = {
query,
}
const res = {
status: jest.fn().mockReturnThis(),
send: jest.fn().mockReturnThis(),
json: jest.fn().mockReturnThis(),
setHeader: jest.fn(),
}
await provider(req, res)
return res.json.mock.calls[0][0]
}