From e8b01fadf3d91b9dddbf11142fa2deb807b2c971 Mon Sep 17 00:00:00 2001 From: "kiloconnect[bot]" <240665456+kiloconnect[bot]@users.noreply.github.com> Date: Tue, 25 Aug 2026 16:14:43 +0000 Subject: [PATCH] test(web): prune tautological/duplicate tests in utils.test.ts - Remove the two 'compile-time test' cases for assertNotNullish and toNonNullish. Both self-describe as TypeScript narrowing checks; any regression there would be caught by tsc/typecheck, not by these runtime assertions. The runtime throw/no-throw behavior they exercise is already fully covered by the adjacent tests in the same describe blocks. - Remove 'should preserve console.log behavior on JSON parse error' in parseResultJsonWithZodSchema tests. It never asserts anything about console.log, and duplicates the exact setup/execution/assertion of 'should handle error response when JSON parsing fails' one test above it (same createMockResponse(400, 'Bad Request', null, true) input, same rejects.toThrow assertion). --- apps/web/src/lib/utils.test.ts | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/apps/web/src/lib/utils.test.ts b/apps/web/src/lib/utils.test.ts index a73603cc83..054b464028 100644 --- a/apps/web/src/lib/utils.test.ts +++ b/apps/web/src/lib/utils.test.ts @@ -25,20 +25,6 @@ describe('assertNotNull', () => { expect(() => assertNotNullish(null, customMessage)).toThrow(customMessage); expect(() => assertNotNullish(undefined, customMessage)).toThrow(customMessage); }); - - it('should properly narrow types (compile-time test)', () => { - // This test verifies TypeScript type narrowing works correctly - const nullableString: string | null = 'test'; - const nullableNumber: number | undefined = 42; - - // After assertNotNull, TypeScript should know these are not null/undefined - assertNotNullish(nullableString); - assertNotNullish(nullableNumber); - - // These should work without type errors after assertion - expect(nullableString.toUpperCase()).toBe('TEST'); - expect(nullableNumber.toFixed(2)).toBe('42.00'); - }); }); describe('parseResultJsonWithZodSchema', () => { @@ -168,14 +154,6 @@ describe('parseResultJsonWithZodSchema', () => { expect(result).toEqual(arrayData); expect(jsonMock).toHaveBeenCalledTimes(1); }); - - it('should preserve console.log behavior on JSON parse error', async () => { - const { response } = createMockResponse(400, 'Bad Request', null, true); - - await expect(parseResultJsonWithZodSchema(response, testSchema)).rejects.toThrow( - 'Failed to fetch data: Bad Request' - ); - }); }); describe('isDateOnlyString', () => { @@ -283,12 +261,4 @@ describe('requireNotNull', () => { expect(() => toNonNullish(null, 'FOO')).toThrow('FOO'); expect(() => toNonNullish(undefined, 'FOO')).toThrow('FOO'); }); - - it('should properly narrow return type (compile-time test)', () => { - const nullableString: string | null = 'test'; - const nullableNumber: number | undefined = 42; - - expect(toNonNullish(nullableString).toUpperCase()).toBe('TEST'); - expect(toNonNullish(nullableNumber).toFixed(2)).toBe('42.00'); - }); });