Skip to content

Commit

Permalink
smoke tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidNic11 committed Feb 6, 2025
1 parent 776c1d6 commit d1a4d62
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from "react";

import { render, screen } from "@testing-library/react";
import { vi } from "vitest";

import JQLTextArea from "./JqlTextArea";

describe("<JQLTextArea />", () => {
it("renders without crashing", () => {
render(
<JQLTextArea
jql="issueType in (Epic, Story) order by Rank"
setJql={vi.fn()}
isLoading
isSuccess={false}
totalChunks={10}
receivedChunks={5}
numberOfIssues={10}
/>
);

const jqlTextarea = screen.getByLabelText("Add your JQL");
expect(jqlTextarea).toBeInTheDocument();

const issuesLoadedText = screen.getByText("Loaded 5 of 10 issues");
expect(issuesLoadedText).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from "react";

import { render, screen } from "@testing-library/react";
import { vi } from "vitest";

import LoadChildren from "./LoadChildren";

describe("<LoadChildren />", () => {
it("renders without crashing", () => {
render(
<LoadChildren
loadChildren={false}
setLoadChildren={vi.fn()}
childJql=""
setChildJql={vi.fn()}
/>
);

const accordionTitle = screen.getByText(/load children/i);
expect(accordionTitle).toBeInTheDocument();

const loadChildrenCheckbox = screen.getByLabelText(
/load all children of jql specified issues/i
);
expect(loadChildrenCheckbox).toBeInTheDocument();

const childJqlLabel = screen.queryByLabelText(/optional children jql filters/i);
expect(childJqlLabel).not.toBeInTheDocument();
});

it("shows child JQL input when loadChildren is checked", () => {
render(
<LoadChildren
loadChildren={true}
setLoadChildren={vi.fn()}
childJql=""
setChildJql={vi.fn()}
/>
);

const childJqlLabel = screen.getByLabelText(/optional children jql filters/i);
expect(childJqlLabel).toBeInTheDocument();

const childJqlInput = screen.getByLabelText(/optional children jql filters/i);
expect(childJqlInput).toBeInTheDocument();
});
});

0 comments on commit d1a4d62

Please sign in to comment.