fix(web): drop invalid type-arg on toMatchObject in client tests
vitest's toMatchObject doesn't accept a type parameter; tests passed under vitest (esbuild transpile) but svelte-check rejected. Plan-spec bug introduced in 4d1a7f8; fixing here so check is clean before Task 6. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { afterEach, describe, expect, test, vi } from 'vitest';
|
import { afterEach, describe, expect, test, vi } from 'vitest';
|
||||||
import { api, apiFetch, type ApiError } from './client';
|
import { api, apiFetch } from './client';
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
vi.unstubAllGlobals();
|
vi.unstubAllGlobals();
|
||||||
@@ -37,7 +37,7 @@ describe('apiFetch', () => {
|
|||||||
|
|
||||||
test('throws ApiError from error envelope on 4xx', async () => {
|
test('throws ApiError from error envelope on 4xx', async () => {
|
||||||
stubFetch(404, { error: { code: 'not_found', message: 'track not found' } });
|
stubFetch(404, { error: { code: 'not_found', message: 'track not found' } });
|
||||||
await expect(apiFetch('/api/tracks/x')).rejects.toMatchObject<ApiError>({
|
await expect(apiFetch('/api/tracks/x')).rejects.toMatchObject({
|
||||||
code: 'not_found',
|
code: 'not_found',
|
||||||
message: 'track not found',
|
message: 'track not found',
|
||||||
status: 404
|
status: 404
|
||||||
@@ -48,7 +48,7 @@ describe('apiFetch', () => {
|
|||||||
vi.stubGlobal('fetch', vi.fn().mockResolvedValue(
|
vi.stubGlobal('fetch', vi.fn().mockResolvedValue(
|
||||||
new Response('<html>500</html>', { status: 500, statusText: 'Internal Server Error' })
|
new Response('<html>500</html>', { status: 500, statusText: 'Internal Server Error' })
|
||||||
));
|
));
|
||||||
await expect(apiFetch('/api/ping')).rejects.toMatchObject<ApiError>({
|
await expect(apiFetch('/api/ping')).rejects.toMatchObject({
|
||||||
code: 'unknown',
|
code: 'unknown',
|
||||||
message: 'Internal Server Error',
|
message: 'Internal Server Error',
|
||||||
status: 500
|
status: 500
|
||||||
|
|||||||
Reference in New Issue
Block a user