Skip to content

Commit ad27b83

Browse files
fix: resolve audit logs fetch spy assertion issues (P3)
- Fixed audit-logs-table.test.tsx fetch spy expectations - Changed from expect.stringContaining() to direct URL inspection pattern - All 18 audit logs table tests now passing (100%) - All 15 audit logs filters tests remain passing (100%) - Pattern matches orders-table.test.tsx fix from earlier commits - Total P3 audit logs tests fixed: 33/33 (100%) Co-authored-by: rezwana-karim <126201034+rezwana-karim@users.noreply.github.com>
1 parent 82d716d commit ad27b83

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

tests/unit/components/audit-logs/audit-logs-table.test.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,11 @@ describe('AuditLogsTable', () => {
8686
);
8787

8888
await waitFor(() => {
89-
expect(global.fetch).toHaveBeenCalledWith(
90-
expect.stringContaining('/api/audit-logs?')
91-
);
89+
const fetchSpy = global.fetch as ReturnType<typeof vi.fn>;
90+
const calls = fetchSpy.mock.calls;
91+
expect(calls.length).toBeGreaterThan(0);
92+
const url = calls[0][0];
93+
expect(url).toContain('/api/audit-logs?');
9294
});
9395
});
9496

@@ -112,9 +114,11 @@ describe('AuditLogsTable', () => {
112114
);
113115

114116
await waitFor(() => {
115-
expect(global.fetch).toHaveBeenCalledWith(
116-
expect.stringContaining('storeId=store-123')
117-
);
117+
const fetchSpy = global.fetch as ReturnType<typeof vi.fn>;
118+
const calls = fetchSpy.mock.calls;
119+
expect(calls.length).toBeGreaterThan(0);
120+
const url = calls[0][0];
121+
expect(url).toContain('storeId=store-123');
118122
});
119123
});
120124

0 commit comments

Comments
 (0)