Skip to content

Commit 345b229

Browse files
Copilothotlong
andcommitted
fix: address code review feedback on test quality
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 22ce77c commit 345b229

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

apps/console/src/__tests__/CalendarNestedConfig.test.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ vi.mock('react-router-dom', () => ({
2929
useNavigate: () => vi.fn(),
3030
}));
3131

32-
// Use dates in current month so events show on the visible calendar
32+
// Use dates in current month so events show on the visible calendar (month view shows all days 1-31)
3333
const now = new Date();
3434
const year = now.getFullYear();
3535
const month = String(now.getMonth() + 1).padStart(2, '0');
@@ -120,12 +120,11 @@ describe('CRM Calendar View with Nested Config', () => {
120120
</SchemaRendererProvider>
121121
);
122122

123+
// Wait for calendar region to render and data to load
123124
await waitFor(() => {
124-
expect(mockDataSource.find).toHaveBeenCalled();
125-
}, { timeout: 3000 });
126-
127-
// Wait for rendering
128-
await new Promise(r => setTimeout(r, 500));
125+
const calendarRegion = document.querySelector('[aria-label="Calendar"]');
126+
expect(calendarRegion).toBeInTheDocument();
127+
}, { timeout: 5000 });
129128

130129
// Should NOT show "Untitled" - that would mean titleField defaulted to 'name'
131130
expect(screen.queryByText('Untitled')).not.toBeInTheDocument();

0 commit comments

Comments
 (0)