Skip to content

Commit

Permalink
Adapt client unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davelopez committed May 15, 2024
1 parent aabd492 commit 935d048
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const ARCHIVED_TEST_HISTORY = {
const REMOTE_FILES_API_ENDPOINT = new RegExp("/api/remote_files/plugins");

async function mountComponentWithHistory(history?: HistorySummary) {
const pinia = createTestingPinia();
const pinia = createTestingPinia({ stubActions: false });
setActivePinia(pinia);
const historyStore = useHistoryStore(pinia);

Expand All @@ -50,6 +50,7 @@ async function mountComponentWithHistory(history?: HistorySummary) {
const wrapper = shallowMount(HistoryArchiveWizard, {
propsData: { historyId: TEST_HISTORY_ID },
localVue,
pinia,
});
await flushPromises();
return wrapper;
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/History/Export/HistoryExport.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const REMOTE_FILES_API_RESPONSE: FilesSourcePlugin[] = [
];

async function mountHistoryExport() {
const pinia = createTestingPinia();
const pinia = createTestingPinia({ stubActions: false });
setActivePinia(pinia);
const historyStore = useHistoryStore(pinia);

Expand Down
3 changes: 3 additions & 0 deletions client/src/components/HistoryExport/Index.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { createTestingPinia } from "@pinia/testing";
import { shallowMount } from "@vue/test-utils";
import { getLocalVue } from "tests/jest/helpers";

Expand All @@ -19,11 +20,13 @@ describe("Index.vue", () => {

it("should render tabs", () => {
// just make sure the component renders to catch obvious big errors
const pinia = createTestingPinia();
const wrapper = shallowMount(Index, {
propsData: {
historyId: "test_id",
},
localVue,
pinia,
});
expect(wrapper.exists("b-tabs-stub")).toBeTruthy();
});
Expand Down
4 changes: 3 additions & 1 deletion client/src/composables/fileSources.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { createTestingPinia } from "@pinia/testing";
import { shallowMount } from "@vue/test-utils";
import flushPromises from "flush-promises";
import { defineComponent } from "vue";
Expand Down Expand Up @@ -28,7 +29,8 @@ const TestComponent = defineComponent({
});

function setupWrapper(): any {
return shallowMount(TestComponent, {});
const pinia = createTestingPinia({ stubActions: false });
return shallowMount(TestComponent, { pinia });
}

describe("useFileSources", () => {
Expand Down

0 comments on commit 935d048

Please sign in to comment.