Skip to content

Commit

Permalink
fix failing jests without testing pinias
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedhamidawan committed Dec 12, 2023
1 parent 549a776 commit 320a1e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { createTestingPinia } from "@pinia/testing";
import { mount } from "@vue/test-utils";
import axios from "axios";
import MockAdapter from "axios-mock-adapter";
Expand All @@ -10,6 +11,7 @@ import DatasetAttributes from "./DatasetAttributes";
const localVue = getLocalVue();

async function buildWrapper(conversion_disable = false) {
const pinia = createTestingPinia();
const wrapper = mount(DatasetAttributes, {
propsData: {
datasetId: "dataset_id",
Expand All @@ -28,6 +30,7 @@ async function buildWrapper(conversion_disable = false) {
FontAwesomeIcon: false,
FormElement: false,
},
pinia,
});
await flushPromises();
return wrapper;
Expand Down
3 changes: 3 additions & 0 deletions client/src/components/Form/FormDisplay.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { createTestingPinia } from "@pinia/testing";
import { mount } from "@vue/test-utils";
import { getLocalVue } from "tests/jest/helpers";

Expand All @@ -8,6 +9,7 @@ const localVue = getLocalVue();
describe("FormDisplay", () => {
let wrapper;
let propsData;
const pinia = createTestingPinia();

beforeEach(() => {
propsData = {
Expand Down Expand Up @@ -94,6 +96,7 @@ describe("FormDisplay", () => {
propsData,
localVue,
stubs: {},
pinia,
});
});

Expand Down

0 comments on commit 320a1e6

Please sign in to comment.