Skip to content

Commit d18ce5f

Browse files
Aboudjemclaude
andcommitted
fix: add non-null assertions to mock.calls array access in tests
tsgo flags `mock.calls[0][0]` as "Object is possibly undefined" — add `!` after the first index access to match the convention used everywhere else in this test file. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ba7df76 commit d18ce5f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

packages/core/test/shared/protocol.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5548,7 +5548,7 @@ describe('Error handling for missing resolvers', () => {
55485548

55495549
// Should have sent an error response
55505550
expect(sendSpy).toHaveBeenCalledTimes(1);
5551-
const sentMessage = sendSpy.mock.calls[0][0] as JSONRPCErrorResponse;
5551+
const sentMessage = sendSpy.mock.calls[0]![0] as JSONRPCErrorResponse;
55525552
expect(sentMessage.jsonrpc).toBe('2.0');
55535553
expect(sentMessage.id).toBe(unsafeId);
55545554
expect(sentMessage.error.code).toBe(ProtocolErrorCode.InvalidRequest);
@@ -5576,7 +5576,7 @@ describe('Error handling for missing resolvers', () => {
55765576

55775577
// Should have sent a successful response, not an error
55785578
expect(sendSpy).toHaveBeenCalledTimes(1);
5579-
const sentMessage = sendSpy.mock.calls[0][0] as JSONRPCResultResponse;
5579+
const sentMessage = sendSpy.mock.calls[0]![0] as JSONRPCResultResponse;
55805580
expect(sentMessage.jsonrpc).toBe('2.0');
55815581
expect(sentMessage.id).toBe(Number.MAX_SAFE_INTEGER);
55825582
expect(sentMessage.result).toBeDefined();
@@ -5603,7 +5603,7 @@ describe('Error handling for missing resolvers', () => {
56035603

56045604
// Should have sent a successful response
56055605
expect(sendSpy).toHaveBeenCalledTimes(1);
5606-
const sentMessage = sendSpy.mock.calls[0][0] as JSONRPCResultResponse;
5606+
const sentMessage = sendSpy.mock.calls[0]![0] as JSONRPCResultResponse;
56075607
expect(sentMessage.jsonrpc).toBe('2.0');
56085608
expect(sentMessage.id).toBe('9007199254740992');
56095609
expect(sentMessage.result).toBeDefined();

0 commit comments

Comments
 (0)