Created
September 26, 2022 13:30
-
-
Save marta-pinkowska/f8bd761b4db21f1248423bdbfc60b4c0 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
// src/FancyHomepageFeature/msw/mswHandlers.js | |
import { rest } from 'msw'; | |
// import the server created for the entire test suite | |
// this mock server includes commonMswHandlers | |
import { server } from '../tools/jest/server'; | |
const homeHandlers = [ | |
rest.get('https://fancy-app.com/homepage-data', (req, res, ctx) => { | |
return res( | |
ctx.json({ | |
contents: [ | |
{ | |
banner: 'Fancy Banner' | |
}, | |
], | |
}) | |
); | |
}), | |
]; | |
export const setupHomeHandlers = () => { | |
server.use(...homeHandlers); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment