mirror of
https://github.com/uetchy/namae.git
synced 2025-08-21 02:08:12 +09:00
feat(api): typescript
This commit is contained in:
13
api/util/testHelpers.ts
Normal file
13
api/util/testHelpers.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export async function mockProvider(provider: any, query: any) {
|
||||
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]
|
||||
}
|
Reference in New Issue
Block a user