Skip to content

Commit cb9a096

Browse files
doublegateclaude
andcommitted
test(gui): fix FindingDetail test assertions for dynamic dialog title
Fix frontend test failures in FindingDetail.test.tsx by updating text assertions to match the actual dynamic dialog title format. The component renders "Finding Details: {service} on {host}:{port}" but tests were expecting just "Finding Details". Changes: - Replace exact text match with regex pattern (/Finding Details:/) in two test cases to accommodate the dynamic title format - Ensures tests pass in CI/CD workflows while maintaining coverage Fixes 2 test failures in GUI CI workflow (121 tests now pass) Technical Details: - Tests affected: "renders finding details correctly" and "calls onClose when dialog is dismissed" - Root cause: Component uses more specific title than original test expectations - Solution: Use flexible regex matching instead of exact string matching Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 186b321 commit cb9a096

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

crates/spectre-gui/frontend/src/components/reports/__tests__/FindingDetail.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('FindingDetail', () => {
3232
/>
3333
);
3434

35-
expect(screen.getByText('Finding Details')).toBeInTheDocument();
35+
expect(screen.getByText(/Finding Details:/)).toBeInTheDocument();
3636
expect(screen.getByText('192.168.1.1')).toBeInTheDocument();
3737
expect(screen.getByText('OpenSSH 7.4')).toBeInTheDocument();
3838
expect(screen.getByText('Outdated SSH version with known vulnerabilities')).toBeInTheDocument();
@@ -82,7 +82,7 @@ describe('FindingDetail', () => {
8282
// Dialog should have a close button (provided by Dialog component)
8383
// We can't easily test this without mocking the Dialog component
8484
// But we can verify the dialog is rendered
85-
expect(screen.getByText('Finding Details')).toBeInTheDocument();
85+
expect(screen.getByText(/Finding Details:/)).toBeInTheDocument();
8686
});
8787

8888
it('handles export actions', () => {

0 commit comments

Comments
 (0)