Skip to content

Commit

Permalink
stub help popovers in formdata to eliminate extra logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Nov 19, 2024
1 parent cafd49b commit ab564e2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createTestingPinia } from "@pinia/testing";
import { mount } from "@vue/test-utils";
import { PiniaVuePlugin } from "pinia";
import { dispatchEvent, getLocalVue } from "tests/jest/helpers";
import { dispatchEvent, getLocalVue, stubHelpPopovers } from "tests/jest/helpers";

import { testDatatypesMapper } from "@/components/Datatypes/test_fixtures";
import { useDatatypesMapperStore } from "@/stores/datatypesMapperStore";
Expand Down Expand Up @@ -51,6 +51,8 @@ const defaultOptions = {
const SELECT_OPTIONS = ".multiselect__element";
const SELECTED_VALUE = ".multiselect__option--selected span";

stubHelpPopovers();

describe("FormData", () => {
it("regular data", async () => {
const wrapper = createTarget({
Expand Down
4 changes: 3 additions & 1 deletion client/src/components/JobInformation/JobInformation.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { mount } from "@vue/test-utils";
import flushPromises from "flush-promises";
import { getLocalVue } from "tests/jest/helpers";
import { getLocalVue, stubHelpPopovers } from "tests/jest/helpers";

import { useServerMock } from "@/api/client/__mocks__";

Expand All @@ -16,6 +16,8 @@ const localVue = getLocalVue();

const { server, http } = useServerMock();

stubHelpPopovers();

describe("JobInformation/JobInformation.vue", () => {
let wrapper;
let jobInfoTable;
Expand Down
9 changes: 9 additions & 0 deletions client/tests/jest/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,12 @@ export function injectTestRouter(localVue) {
export function suppressDebugConsole() {
jest.spyOn(console, "debug").mockImplementation(jest.fn());
}

export function stubHelpPopovers() {
// bootstrap vue will try to match targets to actual HTML elements in DOM but there
// may be no DOM for jest tests, just stub out an alternative minimal implementation.
jest.mock("@/components/Help/HelpPopover.vue", () => ({
name: "HelpPopover",
render: (h) => h("div", "Mocked Popover"),
}));
}

0 comments on commit ab564e2

Please sign in to comment.