Skip to content

Commit 2ef0b0a

Browse files
committed
fix: typecheck error
1 parent 100c394 commit 2ef0b0a

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

server/api/speakers/[year].test.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, it, expect, vi, beforeEach } from 'vitest';
2-
import { getRouterParam, createError } from 'h3';
2+
import { getRouterParam, createError, type H3Event, type EventHandlerRequest } from 'h3';
33
import type { SpeakerInfo } from '~~/types';
44
import handler from './[year]';
55

@@ -18,7 +18,7 @@ vi.mock('~~/server/data', () => ({
1818
}));
1919

2020
describe('/api/speakers/[year]', () => {
21-
const mockEvent = {} as unknown;
21+
const mockEvent = {} as unknown as H3Event<EventHandlerRequest>;
2222

2323
beforeEach(() => {
2424
vi.clearAllMocks();
@@ -95,11 +95,10 @@ describe('/api/speakers/[year]', () => {
9595

9696
describe('無効な年のリクエスト', () => {
9797
it.each([
98-
['2020', '無効な年'],
99-
['abc', '数値でない年'],
100-
['', '空の年パラメータ'],
101-
[null, 'nullの年パラメータ'],
102-
[undefined, 'undefinedの年パラメータ'],
98+
'2020', // 無効な年
99+
'abc', // 数値でない年
100+
'', // 空のパラメータ
101+
undefined,
103102
])('%sの場合エラーをスローする', (year) => {
104103
vi.mocked(getRouterParam).mockReturnValue(year);
105104

0 commit comments

Comments
 (0)