Skip to content

Commit b2caecf

Browse files
committed
fix(ci): resolve TS errors in voice test files — null assertions, return types, provider config
1 parent f710e3d commit b2caecf

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/voice/__tests__/TwilioMediaStreamParser.spec.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ describe('TwilioMediaStreamParser', () => {
3131
expect(result).not.toBeNull();
3232
expect(result!.type).toBe('start');
3333
if (result!.type === 'start') {
34-
expect(result.streamSid).toBe('MZ001');
35-
expect(result.callSid).toBe('CA001');
34+
expect(result!.streamSid).toBe('MZ001');
35+
expect(result!.callSid).toBe('CA001');
3636
}
3737
});
3838

@@ -64,8 +64,8 @@ describe('TwilioMediaStreamParser', () => {
6464
expect(result).not.toBeNull();
6565
expect(result!.type).toBe('audio');
6666
if (result!.type === 'audio') {
67-
expect(result.streamSid).toBe('MZ001');
68-
expect(result.payload).toEqual(rawBytes);
67+
expect(result!.streamSid).toBe('MZ001');
68+
expect(result!.payload).toEqual(rawBytes);
6969
}
7070
});
7171

@@ -115,9 +115,9 @@ describe('TwilioMediaStreamParser', () => {
115115
expect(result).not.toBeNull();
116116
expect(result!.type).toBe('dtmf');
117117
if (result!.type === 'dtmf') {
118-
expect(result.digit).toBe('5');
119-
expect(result.streamSid).toBe('MZ001');
120-
expect(result.durationMs).toBe(500);
118+
expect(result!.digit).toBe('5');
119+
expect(result!.streamSid).toBe('MZ001');
120+
expect(result!.durationMs).toBe(500);
121121
}
122122
});
123123

@@ -132,7 +132,7 @@ describe('TwilioMediaStreamParser', () => {
132132

133133
expect(result?.type).toBe('dtmf');
134134
if (result?.type === 'dtmf') {
135-
expect(result.durationMs).toBeUndefined();
135+
expect(result!.durationMs).toBeUndefined();
136136
}
137137
});
138138
});
@@ -150,7 +150,7 @@ describe('TwilioMediaStreamParser', () => {
150150
expect(result).not.toBeNull();
151151
expect(result!.type).toBe('stop');
152152
if (result!.type === 'stop') {
153-
expect(result.streamSid).toBe('MZ001');
153+
expect(result!.streamSid).toBe('MZ001');
154154
}
155155
});
156156
});
@@ -172,8 +172,8 @@ describe('TwilioMediaStreamParser', () => {
172172
expect(result).not.toBeNull();
173173
expect(result!.type).toBe('mark');
174174
if (result!.type === 'mark') {
175-
expect(result.name).toBe('done');
176-
expect(result.streamSid).toBe('MZ001');
175+
expect(result!.name).toBe('done');
176+
expect(result!.streamSid).toBe('MZ001');
177177
}
178178
});
179179
});

src/voice/__tests__/telephony-integration.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import type { AudioFrame } from '../../voice-pipeline/types.js';
2727
// ─────────────────────────────────────────────────────────────────────────────
2828

2929
/** Build a minimal mock WebSocket-like EventEmitter. */
30-
function createMockWS() {
31-
const ws = new EventEmitter() as ReturnType<typeof createMockWS>;
30+
function createMockWS(): EventEmitter & { send: ReturnType<typeof vi.fn>; close: ReturnType<typeof vi.fn> } {
31+
const ws = new EventEmitter();
3232
(ws as any).send = vi.fn();
3333
(ws as any).close = vi.fn();
3434
return ws as EventEmitter & { send: ReturnType<typeof vi.fn>; close: ReturnType<typeof vi.fn> };
@@ -232,7 +232,7 @@ describe('CallManager + TwilioVoiceProvider integration', () => {
232232
});
233233

234234
manager = new CallManager({
235-
provider: { provider: 'twilio' },
235+
provider: { provider: 'twilio', config: { accountSid: 'test', authToken: 'test', phoneNumber: '+1' } } as any,
236236
webhookBaseUrl: 'https://example.com',
237237
});
238238

0 commit comments

Comments
 (0)