Skip to content

Commit

Permalink
35280 add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
lcbdl committed Dec 25, 2024
1 parent 2f54c76 commit e136b3d
Showing 1 changed file with 75 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,81 @@ describe("ColumnSelectorUtils", () => {
})
).toEqual("assemblages.name");
});

it("Generate column functions path", () => {
expect(
generateColumnPath({
indexMapping: {
label: "columnFunction",
value: "columnFunction",
path: "columnFunction",
hideField: false,
type: "columnFunction",
dynamicField: {
type: "columnFunction",
label: "columnFunction",
path: ""
},
containsSupport: false,
distinctTerm: false,
keywordMultiFieldSupport: false,
keywordNumericSupport: false,
optimizedPrefix: false,
endsWithSupport: false
}
})
).toEqual("columnFunction");

expect(
generateColumnPath({
indexMapping: {
label: "columnFunction",
value: "columnFunction",
path: "columnFunction",
hideField: false,
type: "columnFunction",
dynamicField: {
type: "columnFunction",
label: "columnFunction",
path: ""
},
containsSupport: false,
distinctTerm: false,
keywordMultiFieldSupport: false,
keywordNumericSupport: false,
optimizedPrefix: false,
endsWithSupport: false
},
dynamicFieldValue:
'{"function1":{"functionName":"CONCAT","params":[{"label":"barcode","value":"data.attributes.barcode","hideField":false,"type":"text","path":"data.attributes","keywordMultiFieldSupport":true,"keywordNumericSupport":false,"optimizedPrefix":false,"containsSupport":false,"endsWithSupport":false},{"label":"createdBy","value":"data.attributes.createdBy","hideField":false,"type":"text","path":"data.attributes","keywordMultiFieldSupport":true,"keywordNumericSupport":false,"optimizedPrefix":false,"containsSupport":false,"endsWithSupport":false}]}}'
})
).toEqual("columnFunction/function1/CONCAT/barcode+createdBy");

expect(
generateColumnPath({
indexMapping: {
label: "columnFunction",
value: "columnFunction",
path: "columnFunction",
hideField: false,
type: "columnFunction",
dynamicField: {
type: "columnFunction",
label: "columnFunction",
path: ""
},
containsSupport: false,
distinctTerm: false,
keywordMultiFieldSupport: false,
keywordNumericSupport: false,
optimizedPrefix: false,
endsWithSupport: false
},
dynamicFieldValue:
'{"function2":{"functionName":"CONVERT_COORDINATES_DD"}}'
})
).toEqual("columnFunction/function2/CONVERT_COORDINATES_DD");
});
});

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

0 comments on commit e136b3d

Please sign in to comment.