Skip to content

Commit

Permalink
jest checks for SwitchToHistoryLink's conditional existence
Browse files Browse the repository at this point in the history
which is based on whether it is the run form or invocation view

Tests changes from commit 6dd5f7c
  • Loading branch information
ahmedhamidawan committed Nov 21, 2024
1 parent 07fb4c1 commit 5a17e0c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions client/src/components/Workflow/WorkflowAnnotation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,19 @@ async function mountWorkflowAnnotation(version: "run_form" | "invocation", ownsW
}

describe("WorkflowAnnotation renders", () => {
it("(always) the run count and history, not indicators if owned not published", async () => {
it("the run count and history, not indicators if owned not published", async () => {
async function checkHasRunCount(version: "run_form" | "invocation") {
const { wrapper } = await mountWorkflowAnnotation(version);

const runCount = wrapper.find(SELECTORS.RUN_COUNT);
expect(runCount.text()).toContain("workflow runs:");
expect(runCount.text()).toContain(SAMPLE_RUN_COUNT.toString());

expect(wrapper.find(SELECTORS.SWITCH_TO_HISTORY_LINK).text()).toBe(TEST_HISTORY.name);
if (version === "run_form") {
expect(wrapper.find(SELECTORS.SWITCH_TO_HISTORY_LINK).exists()).toBe(false);
} else {
expect(wrapper.find(SELECTORS.SWITCH_TO_HISTORY_LINK).text()).toBe(TEST_HISTORY.name);
}

// Since this is the user's own workflow, the indicators link
// (to view all published workflows by the owner) should not be present
Expand Down

0 comments on commit 5a17e0c

Please sign in to comment.