Skip to content

Commit dc41775

Browse files
committed
Migrate remaining test files to Vue 3/VTU v2
Convert propsData to props and use global config for plugins.
1 parent b8a4a65 commit dc41775

26 files changed

+224
-121
lines changed

client/src/components/ConfigTemplates/EditSecretsForm.test.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ const localVue = getLocalVue(true);
1010
describe("EditSecretsForm", () => {
1111
it("should render a secrets for for file source templates", async () => {
1212
const wrapper = mount(EditSecretsForm as object, {
13-
propsData: {
13+
props: {
1414
template: STANDARD_FILE_SOURCE_TEMPLATE,
1515
title: "Secrets FORM for file source",
1616
},
17-
localVue,
17+
global: {
18+
...localVue.global,
19+
plugins: [...localVue.global.plugins],
20+
},
1821
});
1922
const titleText = wrapper.find(".portlet-title-text");
2023
expect(titleText.exists()).toBeTruthy();
@@ -23,11 +26,14 @@ describe("EditSecretsForm", () => {
2326

2427
it("should render a secrets for for object store templates", async () => {
2528
const wrapper = mount(EditSecretsForm as object, {
26-
propsData: {
29+
props: {
2730
template: STANDARD_OBJECT_STORE_TEMPLATE,
2831
title: "Secrets FORM for object store",
2932
},
30-
localVue,
33+
global: {
34+
...localVue.global,
35+
plugins: [...localVue.global.plugins],
36+
},
3137
});
3238
const titleText = wrapper.find(".portlet-title-text");
3339
expect(titleText.exists()).toBeTruthy();

client/src/components/ConfigTemplates/InstanceDropdown.test.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ const localVue = getLocalVue(true);
88
describe("InstanceDropdown", () => {
99
it("should render a drop down without upgrade if upgrade unavailable as an option", async () => {
1010
const wrapper = shallowMount(InstanceDropdown as object, {
11-
propsData: {
11+
props: {
1212
prefix: "file-source",
1313
name: "my cool instance",
1414
routeEdit: "/object_store_instance/edit",
1515
routeUpgrade: "/object_store_instance/upgrade",
1616
isUpgradable: false,
1717
},
18-
localVue,
18+
global: {
19+
...localVue.global,
20+
plugins: [...localVue.global.plugins],
21+
},
1922
});
2023
const menu = wrapper.find(".dropdown-menu");
2124
const links = menu.findAll("button.dropdown-item");
@@ -24,14 +27,17 @@ describe("InstanceDropdown", () => {
2427

2528
it("should render a drop down with upgrade if upgrade available as an option", async () => {
2629
const wrapper = shallowMount(InstanceDropdown as object, {
27-
propsData: {
30+
props: {
2831
prefix: "file-source",
2932
name: "my cool instance",
3033
routeEdit: "/object_store_instance/edit",
3134
routeUpgrade: "/object_store_instance/upgrade",
3235
isUpgradable: true,
3336
},
34-
localVue,
37+
global: {
38+
...localVue.global,
39+
plugins: [...localVue.global.plugins],
40+
},
3541
});
3642
const menu = wrapper.find(".dropdown-menu");
3743
const links = menu.findAll("button.dropdown-item");

client/src/components/ConfigTemplates/TemplateSummaryPopover.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ const localVue = getLocalVue(true);
1010
describe("TemplateSummaryPopover", () => {
1111
it("should render a secrets for for file source templates", async () => {
1212
const wrapper = shallowMount(TemplateSummaryPopover as object, {
13-
propsData: {
13+
props: {
1414
template: STANDARD_FILE_SOURCE_TEMPLATE,
1515
target: "popover-target",
1616
},
17-
localVue,
17+
global: {
18+
...localVue.global,
19+
plugins: [...localVue.global.plugins],
20+
},
1821
});
1922
const popover = wrapper.findComponent({ name: "BPopover" });
2023
expect(popover.attributes().target).toEqual("popover-target");

client/src/components/ConfigTemplates/VaultSecret.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ const localVue = getLocalVue(true);
88
describe("VaultSecret", () => {
99
it("should render a form element", async () => {
1010
const wrapper = shallowMount(VaultSecret as object, {
11-
propsData: {
11+
props: {
1212
name: "secret name",
1313
label: "Label Secret",
1414
help: "here is some good *help*",
1515
isSet: true,
1616
},
17-
localVue,
17+
global: {
18+
...localVue.global,
19+
plugins: [...localVue.global.plugins],
20+
},
1821
});
1922
const titleWrapper = wrapper.find(".ui-form-title-text");
2023
expect(titleWrapper.text()).toEqual("Label Secret");

client/src/components/DatasetInformation/DatasetAttributes.test.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ async function mountDatasetAttributes(conversion_disable = false) {
2727
});
2828

2929
const wrapper = mount(DatasetAttributes as object, {
30-
propsData: {
30+
props: {
3131
datasetId: DATASET_ID,
3232
},
33-
localVue,
34-
pinia,
33+
global: {
34+
...localVue.global,
35+
plugins: [...localVue.global.plugins, pinia],
36+
},
3537
});
3638

3739
await flushPromises();
@@ -43,15 +45,18 @@ async function buildWrapperWithError(error: string) {
4345
const axiosMock = new MockAdapter(axios);
4446
axiosMock.onGet(`/dataset/get_edit?dataset_id=${DATASET_ID}`).reply(400);
4547
const wrapper = mount(DatasetAttributes as object, {
46-
propsData: {
48+
props: {
4749
datasetId: DATASET_ID,
4850
messageText: error,
4951
messageVariant: "danger",
5052
},
51-
localVue,
52-
stubs: {
53-
FontAwesomeIcon: false,
54-
FormElement: false,
53+
global: {
54+
...localVue.global,
55+
plugins: [...localVue.global.plugins],
56+
stubs: {
57+
FontAwesomeIcon: false,
58+
FormElement: false,
59+
},
5560
},
5661
});
5762
await flushPromises();

client/src/components/History/Content/Collection/CollectionDescription.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,13 @@ describe("CollectionDescription", () => {
3636

3737
beforeEach(() => {
3838
wrapper = mount(CollectionDescription as object, {
39-
propsData: {
39+
props: {
4040
hdca: defaultTestHDCA,
4141
},
42-
localVue,
42+
global: {
43+
...localVue.global,
44+
plugins: [...localVue.global.plugins],
45+
},
4346
});
4447
});
4548

client/src/components/History/CurrentHistory/SelectPreferredStore.test.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,25 @@ async function mountComponent(preferredObjectStoreId: string | null = null) {
4040
);
4141

4242
const wrapper = mount(SelectPreferredStore as object, {
43-
propsData: {
43+
props: {
4444
preferredObjectStoreId: preferredObjectStoreId,
4545
history: TEST_HISTORY,
4646
showModal: true,
4747
},
48-
localVue,
49-
stubs: {
50-
BModal: {
51-
template: `
52-
<div>
53-
<slot></slot>
54-
<div class="modal-footer">
55-
<button class="btn btn-primary" @click="$emit('ok')">OK</button>
48+
global: {
49+
...localVue.global,
50+
plugins: [...localVue.global.plugins],
51+
stubs: {
52+
BModal: {
53+
template: `
54+
<div>
55+
<slot></slot>
56+
<div class="modal-footer">
57+
<button class="btn btn-primary" @click="$emit('ok')">OK</button>
58+
</div>
5659
</div>
57-
</div>
58-
`,
60+
`,
61+
},
5962
},
6063
},
6164
});

client/src/components/History/Export/HistoryExportWizard.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,15 @@ async function mountHistoryExportWizard(options: MountOptions = {}) {
9292
setActivePinia(pinia);
9393

9494
const wrapper = mount(HistoryExportWizard as object, {
95-
propsData: {
95+
props: {
9696
historyId,
9797
historyName,
9898
isBusy,
9999
},
100-
localVue,
101-
pinia,
100+
global: {
101+
...localVue.global,
102+
plugins: [...localVue.global.plugins, pinia],
103+
},
102104
});
103105

104106
await flushPromises();

client/src/components/History/HistoryOptions.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ async function createWrapper(propsData: object, userData?: any) {
3838
const pinia = createPinia();
3939

4040
const wrapper = shallowMount(HistoryOptions as object, {
41-
propsData,
42-
localVue,
43-
pinia,
41+
props: propsData,
42+
global: {
43+
...localVue.global,
44+
plugins: [...localVue.global.plugins, pinia],
45+
},
4446
});
4547

4648
const userStore = useUserStore();

client/src/components/Login/NewUserConfirmation.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ describe("NewUserConfirmation", () => {
2020
beforeEach(() => {
2121
axiosMock = new MockAdapter(axios);
2222
wrapper = mount(MountTarget as object, {
23-
propsData: {},
24-
localVue,
23+
props: {},
24+
global: {
25+
...localVue.global,
26+
plugins: [...localVue.global.plugins],
27+
},
2528
});
2629
});
2730

0 commit comments

Comments
 (0)