Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions apps/web/src/lib/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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');
});
});