mirror of
https://github.com/hanzoai/msw.git
synced 2026-09-24 17:00:34 +00:00
20 lines
551 B
TypeScript
20 lines
551 B
TypeScript
import { test, expect } from '../../../playwright.extend'
|
|
|
|
test('responds with an XML response body', async ({ loadExample, fetch }) => {
|
|
await loadExample(new URL('./body-xml.mocks.ts', import.meta.url))
|
|
|
|
const res = await fetch('/user')
|
|
const status = res.status()
|
|
const headers = await res.allHeaders()
|
|
const text = await res.text()
|
|
|
|
expect(status).toBe(200)
|
|
expect(headers['content-type']).toBe('text/xml')
|
|
expect(text).toEqual(`
|
|
<user>
|
|
<id>abc-123</id>
|
|
<firstName>John</firstName>
|
|
<lastName>Maverick</lastName>
|
|
</user>`)
|
|
})
|