mirror of
https://github.com/hanzoai/msw.git
synced 2026-09-24 17:00:34 +00:00
27 lines
690 B
TypeScript
27 lines
690 B
TypeScript
import { test, expect } from '../../../../playwright.extend'
|
|
|
|
test('warns on unhandled requests by default', async ({
|
|
loadExample,
|
|
spyOnConsole,
|
|
fetch,
|
|
}) => {
|
|
const consoleSpy = spyOnConsole()
|
|
await loadExample(new URL('./default.mocks.ts', import.meta.url))
|
|
|
|
const res = await fetch('https://mswjs.io/non-existing-page')
|
|
const status = res.status()
|
|
|
|
expect(consoleSpy.get('warning')).toEqual(
|
|
expect.arrayContaining([
|
|
expect.stringMatching(
|
|
/\[MSW\] Warning: intercepted a request without a matching request handler/,
|
|
),
|
|
]),
|
|
)
|
|
|
|
expect(consoleSpy.get('error')).toBeUndefined()
|
|
|
|
// Performs the request as-is.
|
|
expect(status).toBe(404)
|
|
})
|