-
Notifications
You must be signed in to change notification settings - Fork 228
Expand file tree
/
Copy pathAlertTablePathRow.spec.tsx
More file actions
42 lines (38 loc) · 1.22 KB
/
AlertTablePathRow.spec.tsx
File metadata and controls
42 lines (38 loc) · 1.22 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
38
39
40
41
42
import { render as reactRender, screen } from "@testing-library/react";
import type { Props } from "../AlertTablePathRow";
import { AlertTablePathRow } from "../AlertTablePathRow";
import { createMockResults } from "../../../../test/factories/results/mockresults";
describe(AlertTablePathRow.name, () => {
const render = (props?: Props) => {
const mockRef = { current: undefined } as React.RefObject<
HTMLTableRowElement | undefined
>;
const results = createMockResults();
const threadFlow = results[0]?.codeFlows?.[0]?.threadFlows?.[0];
if (!threadFlow) {
throw new Error("ThreadFlow is undefined");
}
reactRender(
<AlertTablePathRow
resultIndex={1}
selectedItem={undefined}
selectedItemRef={mockRef}
path={threadFlow}
pathIndex={0}
currentPathExpanded={true}
databaseUri={"dbUri"}
sourceLocationPrefix="src"
userSettings={{
shouldShowProvenance: false,
}}
updateSelectionCallback={jest.fn()}
toggleExpanded={jest.fn()}
{...props}
/>,
);
};
it("renders number of steps", () => {
render();
expect(screen.getByText("Path (3 steps)")).toBeInTheDocument();
});
});