Skip to content

Commit 0e15c95

Browse files
committed
fix: add non-null assertions to onerror test array access
1 parent 6987780 commit 0e15c95

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
@@ -811,7 +811,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
811811

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

817817
it('should call onerror for invalid JSON-RPC message', async () => {
@@ -828,7 +828,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
828828

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

834834
it('should call onerror for missing Accept header on POST', async () => {
@@ -838,7 +838,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
838838

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

844844
it('should call onerror for unsupported Content-Type', async () => {
@@ -855,7 +855,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
855855

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

861861
it('should call onerror for server not initialized', async () => {
@@ -865,7 +865,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
865865

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

871871
it('should call onerror for invalid session ID', async () => {
@@ -877,7 +877,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
877877

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

883883
it('should call onerror for re-initialization attempt', async () => {
@@ -889,7 +889,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
889889

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

895895
it('should call onerror for GET without Accept header', async () => {
@@ -901,7 +901,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
901901

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

907907
it('should call onerror for concurrent SSE streams', async () => {
@@ -915,7 +915,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
915915

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

921921
it('should call onerror for unsupported protocol version', async () => {
@@ -936,7 +936,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
936936

937937
expect(response.status).toBe(400);
938938
expect(errors.length).toBeGreaterThan(0);
939-
expect(errors[0].message).toContain('Unsupported protocol version');
939+
expect(errors[0]!.message).toContain('Unsupported protocol version');
940940
});
941941
});
942942
});

0 commit comments

Comments
 (0)