restoreHandlers()
Marks all used one-time request handlers as unused, allowing them to affect network again.
Examples
1describe('Book detail', () => {2 before(() => {3 cy.window().then((window) => {4 const { worker, rest } = window56 worker.use(7 rest.get('/book/:bookId', (req, res, ctx) => {8 return res.once(9 ctx.status(500),10 ctx.json({ message: 'Internal server erro' }),11 )12 }),13 )14 })1516 cy.visit('/book/abc-123')17 })1819 test('handles server error in the UI', () => {20 // Initial page load will trigger a one-time request handler override21 // to "GET /book/:bookId" request handler declared in the22 // `before` hook above.23 })2425 test('renders book details', () => {26 // Requests to "GET /book/:bookId" in this test will return27 // a mocked book details, because the server error request handler28 // is a one-time handler that has been already triggered.29 })30})