mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-08-29 03:56:51 +08:00
24 lines
905 B
TypeScript
24 lines
905 B
TypeScript
import { HttpResponse } from 'msw'
|
|
import { describe, expect, it } from 'vitest'
|
|
import { apiFailureJson, apiJson } from '../support/msw/response'
|
|
|
|
describe('API response fixtures', () => {
|
|
it('keeps raw MSW responses unchanged for HTTP errors and plugin protocols', async () => {
|
|
const response = HttpResponse.json([{ id: 1 }])
|
|
|
|
await expect(response.json()).resolves.toEqual([{ id: 1 }])
|
|
})
|
|
|
|
it('builds the complete main-program success envelope explicitly', async () => {
|
|
const response = apiJson({ id: 1 })
|
|
|
|
await expect(response.json()).resolves.toEqual({ data: { id: 1 }, message: '', success: true })
|
|
})
|
|
|
|
it('builds the complete main-program business-failure envelope explicitly', async () => {
|
|
const response = apiFailureJson('rejected', { id: 1 })
|
|
|
|
await expect(response.json()).resolves.toEqual({ data: { id: 1 }, message: 'rejected', success: false })
|
|
})
|
|
})
|