docs(plan): fix invalid toMatchObject<T> type-arg in auth plan
vitest's toMatchObject doesn't accept a type parameter. Removed the
annotation in Task 3 test code (and the unused ApiError import) so
re-runs of the plan don't reintroduce the type error fixed in 8a6a496.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -153,7 +153,7 @@ Create `web/src/lib/api/client.test.ts`:
|
|||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { afterEach, describe, expect, test, vi } from 'vitest';
|
import { afterEach, describe, expect, test, vi } from 'vitest';
|
||||||
import { apiFetch, type ApiError } from './client';
|
import { apiFetch } from './client';
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
vi.unstubAllGlobals();
|
vi.unstubAllGlobals();
|
||||||
@@ -191,7 +191,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
|
||||||
@@ -202,7 +202,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