title: Problem unit testing a delete method with mock service worker (MSW), node and React
body: <p>I have MSW setup with React and Typescript, the code works in the browser, ie, it deletes the employee, but not in the test, the other tests are working fine. I'm stumped, there's probably something daft that I'm doing, any help would be greatly appreciated<br />
  github repo <a href="https://github.com/cherry15/cc2022react" rel="nofollow noreferrer">https://github.com/cherry15/cc2022react</a><br />
  handlers.ts  <br></p>
  <pre><code>
    rest.delete(`${url}/:employeeId`, (req, res, ctx) =&gt; {  
      const { employeeId } = req.params
      if (employeeId) {
        const employeeIndex = EmployeesData.findIndex(
          (employee) =&gt; employee.id === employeeId.toString()
        )
        if (employeeIndex !== -1) {
          EmployeesData.splice(employeeIndex, 1)
          return res(ctx.status(200))
        } else {
          return res(ctx.status(404))
        }
      }
      return res(ctx.status(400))
    }),
  
  employees.test.tsx
  
  describe('Delete employee', () =&gt; {
    test('clicking on the OK button deletes the employee', async () =&gt; {
      renderWithProviders(&lt;EmployeeList /&gt;)
      await screen.findByRole('heading', { name: /ada lovelace/i })
      await screen.findAllByRole('button', { name: 'Delete employee' })
  
      fireEvent.click(screen.getAllByRole('button', { name: 'Delete employee' })[0])
      fireEvent.click(await screen.findByText('OK'))
      expect(screen.getByText(/ada lovelace/i)).not.toBeInTheDocument()
    })
  })
  </code></pre>