mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Adjust unit test
This commit is contained in:
@@ -2,33 +2,40 @@ import WorkflowIndexActions from "./WorkflowIndexActions";
|
||||
import { shallowMount } from "@vue/test-utils";
|
||||
import { getLocalVue } from "jest/helpers";
|
||||
import { ROOT_COMPONENT } from "utils/navigation";
|
||||
import VueRouter from "vue-router";
|
||||
|
||||
import "jest-location-mock";
|
||||
|
||||
const localVue = getLocalVue(true);
|
||||
localVue.use(VueRouter);
|
||||
|
||||
describe("WorkflowIndexActions.vue", () => {
|
||||
const router = new VueRouter();
|
||||
|
||||
function getCurrentPath($router) {
|
||||
return $router.history.current.path;
|
||||
}
|
||||
|
||||
describe("WorkflowIndexActions", () => {
|
||||
let wrapper;
|
||||
let $router;
|
||||
|
||||
beforeEach(async () => {
|
||||
const propsData = {
|
||||
root: "/root/",
|
||||
};
|
||||
wrapper = shallowMount(WorkflowIndexActions, {
|
||||
propsData,
|
||||
localVue,
|
||||
router,
|
||||
});
|
||||
$router = wrapper.vm.$router;
|
||||
});
|
||||
|
||||
describe("naviation", () => {
|
||||
it("should create a workflow when create is clicked", async () => {
|
||||
await wrapper.find(ROOT_COMPONENT.workflows.new_button.selector).trigger("click");
|
||||
expect(window.location).toBeAt("/root/workflows/create");
|
||||
expect(getCurrentPath($router)).toBe("/workflows/create");
|
||||
});
|
||||
|
||||
it("should import a workflow when create is clicked", async () => {
|
||||
await wrapper.find(ROOT_COMPONENT.workflows.import_button.selector).trigger("click");
|
||||
expect(window.location).toBeAt("/root/workflows/import");
|
||||
expect(getCurrentPath($router)).toBe("/workflows/import");
|
||||
});
|
||||
|
||||
it("should localize button text", async () => {
|
||||
|
||||
@@ -24,12 +24,6 @@ export default {
|
||||
BButton,
|
||||
FontAwesomeIcon,
|
||||
},
|
||||
props: {
|
||||
root: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
navigateToCreate: function () {
|
||||
this.$router.push("/workflows/create");
|
||||
|
||||
Reference in New Issue
Block a user