Skip to content

Commit df5db9d

Browse files
committed
chore: Add joinBy-based filtering by mapping status unit test
1 parent ea6a536 commit df5db9d

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

app/configurator/configurator-state.spec.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
ChartConfig,
77
ChartType,
88
ColumnConfig,
9+
ComboLineDualConfig,
910
ConfiguratorStateConfiguringChart,
1011
DataSource,
1112
Filters,
@@ -820,6 +821,40 @@ describe("getFiltersByMappingStatus", () => {
820821
expect.arrayContaining(["areaColorIri", "symbolColorIri"])
821822
);
822823
});
824+
825+
it("should correctly retrieve filters when using joinBy dimension", () => {
826+
const config = {
827+
chartType: "line-dual",
828+
cubes: [
829+
{
830+
iri: "fo1",
831+
filters: {},
832+
joinBy: "X1",
833+
},
834+
{
835+
iri: "foo2",
836+
filters: {},
837+
joinBy: "X2",
838+
},
839+
],
840+
fields: {
841+
x: {
842+
componentIri: "joinBy",
843+
},
844+
},
845+
} as any as ComboLineDualConfig;
846+
847+
const { mappedFiltersIris } = getFiltersByMappingStatus(config, {
848+
cubeIri: "foo",
849+
joinByIris: ["X1", "X2"],
850+
});
851+
852+
// If the joinBy dimensions are treated as being mapped, we won't apply
853+
// single filters to them when deriving filters from fields.
854+
expect([...mappedFiltersIris]).toEqual(
855+
expect.arrayContaining(["X1", "X2"])
856+
);
857+
});
823858
});
824859

825860
describe("colorMapping", () => {

0 commit comments

Comments
 (0)