Skip to content

Commit cfbeb91

Browse files
committed
fix: resolve all lint errors in test files
- Replace require() with dynamic import in timeout-fix test - Fix unused variable in stream test - Replace no-explicit-any casts with Config type in models test
1 parent 96e4b92 commit cfbeb91

3 files changed

Lines changed: 12 additions & 13 deletions

File tree

test/auth/timeout-fix.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ describe('refreshAccessToken: timeout and error handling', () => {
192192
// ---------------------------------------------------------------------------
193193

194194
describe('handleError: timeout message includes region/auth hint', () => {
195-
it('AbortError message contains region override hint', () => {
196-
const { handleError } = require('../../src/errors/handler');
195+
it('AbortError message contains region override hint', async () => {
196+
const { handleError } = await import('../../src/errors/handler');
197197

198198
const abortErr = new DOMException('The operation was aborted.', 'AbortError');
199199

test/client/stream.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ describe('parseSSE', () => {
231231

232232
// First request — consume all events
233233
const response1 = await fetch(`${server.url}/stream`);
234-
for await (const _ of parseSSE(response1)) { /* consume */ }
234+
for await (const _event of parseSSE(response1)) { void _event; }
235235

236236
// Second request — should work since lock released
237237
const response2 = await fetch(`${server.url}/stream`);

test/commands/music/models.test.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,39 @@
11
import { describe, it, expect } from 'bun:test';
22
import { musicGenerateModel, musicCoverModel, isCodingPlan } from '../../../src/commands/music/models';
3+
import type { Config } from '../../../src/config/schema';
34

45
describe('music models', () => {
56
it('isCodingPlan returns true for sk-cp- key', () => {
6-
expect(isCodingPlan({ apiKey: 'sk-cp-abc' } as any)).toBe(true);
7+
expect(isCodingPlan({ apiKey: 'sk-cp-abc' } as Config)).toBe(true);
78
});
89

910
it('isCodingPlan returns false for sk-api- key', () => {
10-
expect(isCodingPlan({ apiKey: 'sk-api-xyz' } as any)).toBe(false);
11+
expect(isCodingPlan({ apiKey: 'sk-api-xyz' } as Config)).toBe(false);
1112
});
1213

1314
it('musicGenerateModel uses defaultMusicModel when set', () => {
14-
const config = { apiKey: 'sk-api-xyz', defaultMusicModel: 'music-2.6' } as any;
15+
const config = { apiKey: 'sk-api-xyz', defaultMusicModel: 'music-2.6' } as Config;
1516
expect(musicGenerateModel(config)).toBe('music-2.6');
1617
});
1718

1819
it('musicGenerateModel falls back to key-type default when no defaultMusicModel', () => {
19-
const cpConfig = { apiKey: 'sk-cp-abc' } as any;
20+
const cpConfig = { apiKey: 'sk-cp-abc' } as Config;
2021
expect(musicGenerateModel(cpConfig)).toBe('music-2.6');
2122

22-
const apiConfig = { apiKey: 'sk-api-xyz' } as any;
23+
const apiConfig = { apiKey: 'sk-api-xyz' } as Config;
2324
expect(musicGenerateModel(apiConfig)).toBe('music-2.6-free');
2425
});
2526

2627
it('musicCoverModel ignores defaultMusicModel for non-cover models', () => {
27-
// defaultMusicModel is 'music-2.6' (a generate model, not a cover model)
28-
// cover should still use key-type default
29-
const config = { apiKey: 'sk-api-xyz', defaultMusicModel: 'music-2.6' } as any;
28+
const config = { apiKey: 'sk-api-xyz', defaultMusicModel: 'music-2.6' } as Config;
3029
expect(musicCoverModel(config)).toBe('music-cover-free');
3130
});
3231

3332
it('musicCoverModel uses key-type default when no defaultMusicModel', () => {
34-
const cpConfig = { apiKey: 'sk-cp-abc' } as any;
33+
const cpConfig = { apiKey: 'sk-cp-abc' } as Config;
3534
expect(musicCoverModel(cpConfig)).toBe('music-cover');
3635

37-
const apiConfig = { apiKey: 'sk-api-xyz' } as any;
36+
const apiConfig = { apiKey: 'sk-api-xyz' } as Config;
3837
expect(musicCoverModel(apiConfig)).toBe('music-cover-free');
3938
});
4039
});

0 commit comments

Comments
 (0)