From b5c4a7ad608d6e281d3d70abb9f0f0a7bcbf2fe3 Mon Sep 17 00:00:00 2001 From: Laila Los <44241786+ElectronicBlueberry@users.noreply.github.com> Date: Thu, 8 Dec 2022 13:55:25 +0100 Subject: [PATCH] test history import warning --- client/src/components/HistoryImport.test.js | 23 ++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/client/src/components/HistoryImport.test.js b/client/src/components/HistoryImport.test.js index 052cf7df51b..5f212f3993f 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 history by URL from another galaxy instance" + ); + + // Link to the GTN + const link = alert.find("a"); + expect(link.text()).toContain("GTN"); + }); + afterEach(() => { axiosMock.restore(); });