// create mock service worker → to test reception of validation messages
const server = setupServer(
rest.post("/api/1.0/users", (req, res, ctx) => {
// console.log("This line is run");
return res(
ctx.status(400),
ctx.json({
validationErrors: {
"username": "Username cannot be null",
},
})
)
})
);
// runs before any function executes
beforeAll(() => {
server.listen();
});
// runs after all functions execute
afterAll(() => {
server.close();
});