First things first, using React Testing Library most likely means you're talking about tests in Node.js. There's no Service Worker API in Node.js, so we can move away from the worker to solve your use case.
There's no actual need to pause the request to achieve what you want, it seems. Note that most testing frameworks execute assertions immediately, and you won't get any issues getting an assertion as soon as the underlying code is matching (i.e. your UI is in the loading state). Adding as little as 100ms delay to your response is enough for Jest to see that a loading state is present and mark the assertion as passed:
it('displays the loading state', () => {
server.use(
rest.get('/resource', (req, res, ctx) => {
return res(ctx.delay(100), /* the rest of the mocked response */)
})
)
render(<YourComponent />
// ...assert the loading state of the UI.
})
Give this approach a try and let me know if you have any issues with it.