Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions frontend/tomography/src/components/workflows/WorkflowStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import type {
WorkflowStatusSubscriptionSubscriptionVariables,
} from "./__generated__/WorkflowStatus.generated";

const WORKFLOW_STATUS_SUBSCRIPTION: TypedDocumentNode<
export const WORKFLOW_STATUS_SUBSCRIPTION: TypedDocumentNode<
WorkflowStatusSubscriptionSubscription,
WorkflowStatusSubscriptionSubscriptionVariables
> = gql`
Expand All @@ -38,8 +38,6 @@ const WORKFLOW_STATUS_SUBSCRIPTION: TypedDocumentNode<
id
name
status
depends
dependencies
stepType
artifacts {
name
Expand All @@ -56,8 +54,6 @@ const WORKFLOW_STATUS_SUBSCRIPTION: TypedDocumentNode<
id
name
status
depends
dependencies
stepType
artifacts {
name
Expand All @@ -74,8 +70,6 @@ const WORKFLOW_STATUS_SUBSCRIPTION: TypedDocumentNode<
id
name
status
depends
dependencies
stepType
artifacts {
name
Expand All @@ -92,8 +86,6 @@ const WORKFLOW_STATUS_SUBSCRIPTION: TypedDocumentNode<
id
name
status
depends
dependencies
stepType
artifacts {
name
Expand Down
61 changes: 61 additions & 0 deletions frontend/tomography/tests/WorkflowStatus.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import React from "react";
import { expect, test } from "vitest";
import { render, screen } from "@testing-library/react";
import { MockedProvider } from "@apollo/client/testing/react";
import WorkflowStatus, {
WORKFLOW_STATUS_SUBSCRIPTION,
} from "../src/components/workflows/WorkflowStatus";

const WORKFLOW_NAME = "httomo-cor-sweep-abcde";
const VISIT = { proposalCode: "cm", proposalNumber: 40628, number: 3 };

const mocks = [
{
request: {
query: WORKFLOW_STATUS_SUBSCRIPTION,
variables: {
name: WORKFLOW_NAME,
visit: VISIT,
},
},
result: {
data: {
workflow: {
status: {
__typename: "WorkflowRunningStatus",
startTime: "",
message: "Workflow is running",
tasks: [
{
id: 0,
name: "task-0",
status: "WorkflowRunningStatus",
stepType: "Pod",
artifacts: [
{
name: "some-artifact",
url: "https://some-artifact",
mimeType: "image/png",
},
],
},
],
},
},
},
},
},
];

test("running workflow status from subscription displays running in status chip", async () => {
render(
<MockedProvider mocks={mocks}>
<WorkflowStatus
workflow={WORKFLOW_NAME}
visit={`${VISIT.proposalCode}${VISIT.proposalNumber}-${VISIT.number}`}
/>
</MockedProvider>
);

expect(await screen.findByText("Running")).toBeDefined();
});
Loading