From df9f356aeef0a5bb6edfadef5c1a35e8f1e04b12 Mon Sep 17 00:00:00 2001 From: guerler Date: Wed, 30 Aug 2023 12:58:05 +0300 Subject: [PATCH] Add additional test cases to validate appropriate batch mode determination --- .../Form/Elements/FormData/FormData.test.js | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/client/src/components/Form/Elements/FormData/FormData.test.js b/client/src/components/Form/Elements/FormData/FormData.test.js index 2d4eab65a8af..afda8b818bf8 100644 --- a/client/src/components/Form/Elements/FormData/FormData.test.js +++ b/client/src/components/Form/Elements/FormData/FormData.test.js @@ -214,6 +214,20 @@ describe("FormData", () => { expect(wrapper.emitted().input[0][0]).toEqual(value_0); }); + it("dataset collection mapped to non-batch field", async () => { + const wrapper = createTarget({ + type: "data_collection", + value: { values: [{ id: "hdca4", src: "hdca" }] }, + options: defaultOptions, + }); + const value_0 = { + batch: false, + product: false, + values: [{ id: "hdca4", subcollection_type: null, src: "hdca" }], + }; + expect(wrapper.emitted().input[0][0]).toEqual(value_0); + }); + it("multiple dataset collection elements (as hdas)", async () => { const wrapper = createTarget({ value: { @@ -293,7 +307,7 @@ describe("FormData", () => { }); }); - it("match variation on initial value", async () => { + it("match dataset collection on initial value", async () => { const wrapper = createTarget({ value: { values: [{ id: "hdca4", src: "hdca" }], @@ -310,7 +324,7 @@ describe("FormData", () => { expect(wrapper.emitted().input[i][0]).toEqual({ batch: false, product: false, - values: [{ id: "hdca4", map_over_type: null, src: "hdca" }], + values: [{ id: "hdca4", subcollection_type: null, src: "hdca" }], }); } expect(wrapper.emitted().input.length).toEqual(2); @@ -322,7 +336,7 @@ describe("FormData", () => { expect(wrapper.emitted().input[2][0]).toEqual({ batch: false, product: false, - values: [{ id: "hda3", map_over_type: null, src: "hda" }], + values: [{ id: "hda3", subcollection_type: null, src: "hda" }], }); const newSelectedValues = wrapper.findAll(SELECTED_VALUE); expect(newSelectedValues.at(0).text()).toBe("3: hdaName3");