test history import warning

This commit is contained in:
Laila Los
2022-12-08 14:07:01 +01:00
parent 837fe730b1
commit b5c4a7ad60
+20 -3
View File
@@ -1,5 +1,5 @@
import { shallowMount } from "@vue/test-utils";
import { getLocalVue } from "tests/jest/helpers";
import { mount } from "@vue/test-utils";
import { getLocalVue, wait } from "tests/jest/helpers";
import HistoryImport from "./HistoryImport.vue";
import MockAdapter from "axios-mock-adapter";
import axios from "axios";
@@ -21,7 +21,7 @@ describe("HistoryImport.vue", () => {
beforeEach(async () => {
axiosMock = new MockAdapter(axios);
axiosMock.onGet(TEST_PLUGINS_URL).reply(200, [{ id: "foo", writable: false }]);
wrapper = shallowMount(HistoryImport, {
wrapper = mount(HistoryImport, {
propsData: {},
localVue,
});
@@ -76,6 +76,23 @@ describe("HistoryImport.vue", () => {
expect(wrapper.vm.complete).toBeTruthy();
});
it("warns about shared history imports", async () => {
const input = wrapper.find("input[type=url]");
await input.setValue("https://usegalaxy.org/u/some_user/h/exported_history");
await wait(210);
const alert = wrapper.find(".alert");
expect(alert.classes()).toContain("alert-warning");
expect(alert.text()).toContain(
"It looks like you are trying to import a history by URL from another galaxy instance"
);
// Link to the GTN
const link = alert.find("a");
expect(link.text()).toContain("GTN");
});
afterEach(() => {
axiosMock.restore();
});