mirror of
https://github.com/uetchy/namae.git
synced 2025-03-17 12:30:32 +09:00
20 lines
383 B
JavaScript
20 lines
383 B
JavaScript
import nock from 'nock'
|
|
|
|
nock.disableNetConnect()
|
|
|
|
// nock.recorder.rec()
|
|
|
|
global.mockProvider = async (provider, query) => {
|
|
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]
|
|
}
|