-
Notifications
You must be signed in to change notification settings - Fork 228
Expand file tree
/
Copy pathAlertTableResultRow.spec.tsx
More file actions
37 lines (33 loc) · 1.07 KB
/
AlertTableResultRow.spec.tsx
File metadata and controls
37 lines (33 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { render as reactRender, screen } from "@testing-library/react";
import { AlertTableResultRow } from "../AlertTableResultRow";
import type { Props } from "../AlertTableResultRow";
import { createMockResults } from "../../../../test/factories/results/mockresults";
describe(AlertTableResultRow.name, () => {
const render = (props?: Props) => {
const mockRef = { current: undefined } as React.RefObject<
HTMLTableRowElement | undefined
>;
const results = createMockResults();
reactRender(
<AlertTableResultRow
result={results[0]}
expanded={new Set()}
resultIndex={1}
selectedItem={undefined}
selectedItemRef={mockRef}
databaseUri={"dbUri"}
sourceLocationPrefix="src"
userSettings={{
shouldShowProvenance: false,
}}
updateSelectionCallback={jest.fn()}
toggleExpanded={jest.fn()}
{...props}
/>,
);
};
it("renders shortest path badge", () => {
render();
expect(screen.getByTitle("Shortest path")).toHaveTextContent("3");
});
});