mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 08:58:41 +00:00
chore(test): rewritten scheduled query section test using rtl (#5358)
This commit is contained in:
parent
0b120a612d
commit
bd18bf3c7d
1 changed files with 4 additions and 8 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import React from "react";
|
||||
import { mount } from "enzyme";
|
||||
import PATHS from "router/paths";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
|
||||
import ScheduledQueriesSection from "components/side_panels/PackDetailsSidePanel/ScheduledQueriesSection";
|
||||
import { scheduledQueryStub } from "test/stubs";
|
||||
|
|
@ -8,12 +7,9 @@ import { scheduledQueryStub } from "test/stubs";
|
|||
describe("ScheduledQueriesSection - component", () => {
|
||||
it("links the query name to the show query route", () => {
|
||||
const scheduledQuery = { ...scheduledQueryStub, query_id: 55 };
|
||||
const Component = mount(
|
||||
<ScheduledQueriesSection scheduledQueries={[scheduledQuery]} />
|
||||
);
|
||||
const Link = Component.find("Link");
|
||||
const path = `${PATHS.EDIT_QUERY({ id: scheduledQuery.query_id })}`;
|
||||
render(<ScheduledQueriesSection scheduledQueries={[scheduledQuery]} />);
|
||||
|
||||
expect(Link.prop("to")).toEqual(path);
|
||||
expect(screen.getByText("Get all users")).toBeInTheDocument();
|
||||
expect(screen.getByText("Get all users").closest("a")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue