Files
galaxy/client/src/components/WorkflowInvocationState/WorkflowInvocationState.test.js
T
2022-06-15 11:26:53 +02:00

71 lines
2.0 KiB
JavaScript

import WorkflowInvocationState from "./WorkflowInvocationState";
import { shallowMount } from "@vue/test-utils";
import { getLocalVue } from "jest/helpers";
import Vuex from "vuex";
import invocationData from "../Workflow/test/json/invocation.json";
const invocationJobsSummaryById = {
id: "d9833097445452b0",
model: "WorkflowInvocation",
states: {},
populated_state: "ok",
};
const localVue = getLocalVue();
describe("WorkflowInvocationState.vue with terminal invocation", () => {
let wrapper;
let propsData;
beforeEach(async () => {
propsData = {
invocationId: invocationData.id,
};
wrapper = shallowMount(WorkflowInvocationState, {
propsData,
computed: {
invocation: () => invocationData,
getInvocationJobsSummaryById: () => () => invocationJobsSummaryById,
},
localVue,
});
});
it("determines that invocation and job states are terminal", async () => {
expect(wrapper.vm.invocationAndJobTerminal).toBeTruthy();
});
});
describe("WorkflowInvocationState.vue with no invocation", () => {
let wrapper;
let propsData;
let store;
let actions;
beforeEach(async () => {
actions = {
fetchInvocationForId: jest.fn(),
fetchInvocationJobsSummaryForId: jest.fn(),
};
store = new Vuex.Store({
actions,
});
propsData = {
invocationId: invocationData.id,
};
wrapper = shallowMount(WorkflowInvocationState, {
store,
propsData,
computed: {
invocation: () => null,
getInvocationJobsSummaryById: () => () => invocationJobsSummaryById,
},
localVue,
});
});
it("determines that invocation and job states are not terminal", async () => {
expect(wrapper.vm.invocationAndJobTerminal).toBeFalsy();
});
});