chore(tests): fix tsc errors in earlier test files

Two tsc errors surfaced by a later tsc run:

1. browser-image-search-fetcher.test.ts — imported `beforeEach`
   but never used; also `spy.mock.calls[0]` typed as empty tuple
   since vi.fn()'s signature isn't inferred. Cast via `unknown` +
   explicit tuple shape.

2. chart-builders-visual-smoke.test.ts — custom-dimensions case
   passed `width`/`height` to buildChartLine. The real shape is
   `point_spacing` + `chart_height`. Fixed the test to use the
   actual param names (test itself wasn't broken, just the type).
This commit is contained in:
Fini 2026-04-22 10:35:00 +08:00
parent cf3aa4240a
commit 42b6492404
2 changed files with 8 additions and 5 deletions

View file

@ -1,4 +1,4 @@
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
import { describe, it, expect, afterEach, vi } from 'vitest';
import { makeBrowserImageSearchFetcher } from '../browser-image-search-fetcher';
/**
@ -28,9 +28,9 @@ describe('makeBrowserImageSearchFetcher', () => {
expect(result).toBe('https://img.example/x.jpg');
expect(spy).toHaveBeenCalledOnce();
const [url, init] = spy.mock.calls[0];
expect(url).toBe('/api/ai/image-search');
expect((init as RequestInit).method).toBe('POST');
const firstCall = spy.mock.calls[0] as unknown as [string, RequestInit];
expect(firstCall[0]).toBe('/api/ai/image-search');
expect(firstCall[1].method).toBe('POST');
});
it('sends the query in the request body', async () => {

View file

@ -133,7 +133,10 @@ describe('chart builders — visual smoke', () => {
{ name: 'two points only', args: { values: [1, 10] } },
{ name: 'spike in middle', args: { values: [1, 1, 1, 100, 1, 1, 1] } },
{ name: 'fractional values', args: { values: [0.5, 1.5, 2.25, 3.75] } },
{ name: 'custom dimensions', args: { values: [1, 2, 3], width: 400, height: 200 } },
{
name: 'custom dimensions',
args: { values: [1, 2, 3], point_spacing: 50, chart_height: 200 },
},
];
for (const c of cases) {