mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
fix test
This commit is contained in:
@@ -2,12 +2,12 @@ import MockAdapter from "axios-mock-adapter";
|
||||
import axios from "axios";
|
||||
import UploadModal from "./UploadModal";
|
||||
import UploadModalContent from "./UploadModalContent";
|
||||
import store from "../../store";
|
||||
import { mount } from "@vue/test-utils";
|
||||
import { getLocalVue } from "jest/helpers";
|
||||
|
||||
import MockCurrentUser from "../providers/MockCurrentUser";
|
||||
import MockCurrentHistory from "../providers/MockCurrentHistory";
|
||||
import { getLocalVue, mockModule } from "jest/helpers";
|
||||
import { userStore } from "store/userStore";
|
||||
import { historyStore } from "store/historyStore";
|
||||
import { configStore } from "store/configStore";
|
||||
import Vuex from "vuex";
|
||||
|
||||
jest.mock("app");
|
||||
|
||||
@@ -17,6 +17,16 @@ const propsData = {
|
||||
fileSourcesConfigured: true,
|
||||
};
|
||||
|
||||
const createStore = () => {
|
||||
return new Vuex.Store({
|
||||
modules: {
|
||||
user: mockModule(userStore, { currentUser: { id: "fakeuser" } }),
|
||||
history: mockModule(historyStore, { currentHistoryId: "fakehistory", histories: { fakehistory: {} } }),
|
||||
config: mockModule(configStore, { config: {} }),
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("UploadModal.vue", () => {
|
||||
let wrapper;
|
||||
let axiosMock;
|
||||
@@ -47,17 +57,14 @@ describe("UploadModal.vue", () => {
|
||||
axiosMock.onGet(`/api/datatypes?extension_only=False`).reply(200, datatypesResponse);
|
||||
|
||||
const localVue = getLocalVue();
|
||||
const store = createStore();
|
||||
|
||||
wrapper = await mount(UploadModal, {
|
||||
store,
|
||||
provide: { store },
|
||||
propsData,
|
||||
localVue,
|
||||
stubs: {
|
||||
// Need to stub all this horrible-ness because of the last 2 tests
|
||||
// which need to dig into the first layer of the mount tree, will remove
|
||||
// all of this shortly with a PR that completely replaces Upload
|
||||
CurrentUser: MockCurrentUser({ id: "fakeuser" }),
|
||||
UserHistories: MockCurrentHistory({ id: "fakehistory" }),
|
||||
BTabs: true,
|
||||
BTab: true,
|
||||
Collection: true,
|
||||
@@ -66,6 +73,8 @@ describe("UploadModal.vue", () => {
|
||||
RulesInput: true,
|
||||
},
|
||||
});
|
||||
|
||||
await wrapper.vm.open();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -74,8 +83,9 @@ describe("UploadModal.vue", () => {
|
||||
});
|
||||
|
||||
it("should load with correct defaults", async () => {
|
||||
expect(wrapper.vm.auto.id).toBe("auto");
|
||||
expect(wrapper.vm.datatypesDisableAuto).toBe(false);
|
||||
const contentWrapper = wrapper.findComponent(UploadModalContent);
|
||||
expect(contentWrapper.vm.auto.id).toBe("auto");
|
||||
expect(contentWrapper.vm.datatypesDisableAuto).toBe(false);
|
||||
});
|
||||
|
||||
it("should fetch datatypes and parse them", async () => {
|
||||
|
||||
Reference in New Issue
Block a user