1
0
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:
2019-08-30 16:40:22 +09:00
parent 6fbd0346d0
commit f2e45bac4b
24 changed files with 340 additions and 878 deletions

13
api/util/testHelpers.ts Normal file
View 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]
}