mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Split and adapt unit tests
This commit is contained in:
@@ -34,16 +34,6 @@ describe("WorkflowInvocationState.vue with terminal invocation", () => {
|
||||
it("determines that invocation and job states are terminal", async () => {
|
||||
expect(wrapper.vm.invocationAndJobTerminal).toBeTruthy();
|
||||
});
|
||||
|
||||
it("displays report links", async () => {
|
||||
expect(wrapper.find(".invocation-pdf-link").exists()).toBeTruthy();
|
||||
expect(wrapper.find(".invocation-report-link").exists()).toBeTruthy();
|
||||
expect(wrapper.find(".bco-json").exists()).toBeTruthy();
|
||||
});
|
||||
|
||||
it("doesn't show cancel invocation button", async () => {
|
||||
expect(wrapper.find(".cancel-workflow-scheduling").exists()).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
describe("WorkflowInvocationState.vue with no invocation", () => {
|
||||
@@ -77,14 +67,4 @@ describe("WorkflowInvocationState.vue with no invocation", () => {
|
||||
it("determines that invocation and job states are not terminal", async () => {
|
||||
expect(wrapper.vm.invocationAndJobTerminal).toBeFalsy();
|
||||
});
|
||||
|
||||
it("does not display report links", async () => {
|
||||
expect(wrapper.find(".invocation-pdf-link").exists()).toBeFalsy();
|
||||
expect(wrapper.find(".invocation-report-link").exists()).toBeFalsy();
|
||||
expect(wrapper.find(".bco-json").exists()).toBeFalsy();
|
||||
});
|
||||
|
||||
it("shows cancel invocation button", async () => {
|
||||
expect(wrapper.find(".cancel-workflow-scheduling").exists()).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
import WorkflowInvocationSummary from "./WorkflowInvocationSummary";
|
||||
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 mockComputed = {
|
||||
getInvocationJobsSummaryById: () => () => invocationJobsSummaryById,
|
||||
};
|
||||
|
||||
const localVue = getLocalVue();
|
||||
|
||||
describe("WorkflowInvocationSummary.vue with terminal invocation", () => {
|
||||
let wrapper;
|
||||
let propsData;
|
||||
|
||||
beforeEach(async () => {
|
||||
propsData = {
|
||||
invocation: invocationData,
|
||||
invocationAndJobTerminal: true,
|
||||
invocationSchedulingTerminal: true,
|
||||
};
|
||||
wrapper = shallowMount(WorkflowInvocationSummary, {
|
||||
propsData,
|
||||
computed: mockComputed,
|
||||
localVue,
|
||||
});
|
||||
});
|
||||
|
||||
it("displays report links", async () => {
|
||||
expect(wrapper.find(".invocation-pdf-link").exists()).toBeTruthy();
|
||||
expect(wrapper.find(".invocation-report-link").exists()).toBeTruthy();
|
||||
});
|
||||
|
||||
it("doesn't show cancel invocation button", async () => {
|
||||
expect(wrapper.find(".cancel-workflow-scheduling").exists()).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
describe("WorkflowInvocationSummary.vue with invocation scheduling running", () => {
|
||||
let wrapper;
|
||||
let propsData;
|
||||
let store;
|
||||
let actions;
|
||||
|
||||
beforeEach(async () => {
|
||||
actions = {
|
||||
fetchInvocationForId: jest.fn(),
|
||||
fetchInvocationJobsSummaryForId: jest.fn(),
|
||||
};
|
||||
store = new Vuex.Store({
|
||||
actions,
|
||||
});
|
||||
propsData = {
|
||||
invocation: invocationData,
|
||||
invocationAndJobTerminal: false,
|
||||
invocationSchedulingTerminal: false,
|
||||
};
|
||||
wrapper = shallowMount(WorkflowInvocationSummary, {
|
||||
store,
|
||||
propsData,
|
||||
computed: mockComputed,
|
||||
localVue,
|
||||
});
|
||||
});
|
||||
|
||||
it("does not display report links", async () => {
|
||||
expect(wrapper.find(".invocation-pdf-link").exists()).toBeFalsy();
|
||||
expect(wrapper.find(".invocation-report-link").exists()).toBeFalsy();
|
||||
});
|
||||
|
||||
it("shows cancel invocation button", async () => {
|
||||
expect(wrapper.find(".cancel-workflow-scheduling").exists()).toBeTruthy();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user