Skip to content

Commit ce6f778

Browse files
codewithkenzofelixweinberger
authored andcommitted
fix: add non-null assertions to onerror test array access
1 parent c87985e commit ce6f778

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

packages/server/test/server/streamableHttp.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ describe('Zod v4', () => {
808808

809809
expect(response.status).toBe(400);
810810
expect(errors.length).toBeGreaterThan(0);
811-
expect(errors[0].message).toContain('Parse error');
811+
expect(errors[0]!.message).toContain('Parse error');
812812
});
813813

814814
it('should call onerror for invalid JSON-RPC message', async () => {
@@ -825,7 +825,7 @@ describe('Zod v4', () => {
825825

826826
expect(response.status).toBe(400);
827827
expect(errors.length).toBeGreaterThan(0);
828-
expect(errors[0].message).toContain('Parse error');
828+
expect(errors[0]!.message).toContain('Parse error');
829829
});
830830

831831
it('should call onerror for missing Accept header on POST', async () => {
@@ -835,7 +835,7 @@ describe('Zod v4', () => {
835835

836836
expect(response.status).toBe(406);
837837
expect(errors.length).toBeGreaterThan(0);
838-
expect(errors[0].message).toContain('Not Acceptable');
838+
expect(errors[0]!.message).toContain('Not Acceptable');
839839
});
840840

841841
it('should call onerror for unsupported Content-Type', async () => {
@@ -852,7 +852,7 @@ describe('Zod v4', () => {
852852

853853
expect(response.status).toBe(415);
854854
expect(errors.length).toBeGreaterThan(0);
855-
expect(errors[0].message).toContain('Unsupported Media Type');
855+
expect(errors[0]!.message).toContain('Unsupported Media Type');
856856
});
857857

858858
it('should call onerror for server not initialized', async () => {
@@ -862,7 +862,7 @@ describe('Zod v4', () => {
862862

863863
expect(response.status).toBe(400);
864864
expect(errors.length).toBeGreaterThan(0);
865-
expect(errors[0].message).toContain('Server not initialized');
865+
expect(errors[0]!.message).toContain('Server not initialized');
866866
});
867867

868868
it('should call onerror for invalid session ID', async () => {
@@ -874,7 +874,7 @@ describe('Zod v4', () => {
874874

875875
expect(response.status).toBe(404);
876876
expect(errors.length).toBeGreaterThan(0);
877-
expect(errors[0].message).toContain('Session not found');
877+
expect(errors[0]!.message).toContain('Session not found');
878878
});
879879

880880
it('should call onerror for re-initialization attempt', async () => {
@@ -886,7 +886,7 @@ describe('Zod v4', () => {
886886

887887
expect(response.status).toBe(400);
888888
expect(errors.length).toBeGreaterThan(0);
889-
expect(errors[0].message).toContain('Server already initialized');
889+
expect(errors[0]!.message).toContain('Server already initialized');
890890
});
891891

892892
it('should call onerror for GET without Accept header', async () => {
@@ -898,7 +898,7 @@ describe('Zod v4', () => {
898898

899899
expect(response.status).toBe(406);
900900
expect(errors.length).toBeGreaterThan(0);
901-
expect(errors[0].message).toContain('Not Acceptable');
901+
expect(errors[0]!.message).toContain('Not Acceptable');
902902
});
903903

904904
it('should call onerror for concurrent SSE streams', async () => {
@@ -912,7 +912,7 @@ describe('Zod v4', () => {
912912

913913
expect(response2.status).toBe(409);
914914
expect(errors.length).toBeGreaterThan(0);
915-
expect(errors[0].message).toContain('Conflict');
915+
expect(errors[0]!.message).toContain('Conflict');
916916
});
917917

918918
it('should call onerror for unsupported protocol version', async () => {
@@ -933,7 +933,7 @@ describe('Zod v4', () => {
933933

934934
expect(response.status).toBe(400);
935935
expect(errors.length).toBeGreaterThan(0);
936-
expect(errors[0].message).toContain('Unsupported protocol version');
936+
expect(errors[0]!.message).toContain('Unsupported protocol version');
937937
});
938938
});
939939
});

0 commit comments

Comments
 (0)