Created
September 19, 2022 01:57
-
-
Save ksakae1216/a2b56d78668d21d2e92dc5bd35ea18d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { setupWorker, rest } from 'msw' | |
export const mocks = [ | |
rest.get('https://hoge.com/users/:user', (req, res, ctx) => { | |
const { user } = req.params | |
return res( | |
ctx.status(200), | |
ctx.json({ | |
name: `mocked-${user}`, | |
}), | |
) | |
}), | |
] | |
const worker = setupWorker(...mocks) | |
worker.start() | |
export { worker, rest } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment