Skip to content

Commit

Permalink
Add additional test cases to validate appropriate batch mode determin…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
guerler committed Aug 30, 2023
1 parent 7a19f74 commit df9f356
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions client/src/components/Form/Elements/FormData/FormData.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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" }],
Expand All @@ -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);
Expand All @@ -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");
Expand Down

0 comments on commit df9f356

Please sign in to comment.