diff --git a/client/src/components/HistoryImport.test.js b/client/src/components/HistoryImport.test.js index 052cf7df51b..b53c4c1b184 100644 --- a/client/src/components/HistoryImport.test.js +++ b/client/src/components/HistoryImport.test.js @@ -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 published history from another galaxy instance" + ); + + // Link to the GTN + const link = alert.find("a"); + expect(link.text()).toContain("GTN"); + }); + afterEach(() => { axiosMock.restore(); }); diff --git a/client/src/components/HistoryImport.vue b/client/src/components/HistoryImport.vue index 7ab8df2f8cd..7149f9aa5e2 100644 --- a/client/src/components/HistoryImport.vue +++ b/client/src/components/HistoryImport.vue @@ -1,8 +1,7 @@ +