Skip to content

Commit

Permalink
chore: Add joinBy-based filtering by mapping status unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
bprusinowski committed Dec 4, 2023
1 parent ea6a536 commit df5db9d
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions app/configurator/configurator-state.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ChartConfig,
ChartType,
ColumnConfig,
ComboLineDualConfig,
ConfiguratorStateConfiguringChart,
DataSource,
Filters,
Expand Down Expand Up @@ -820,6 +821,40 @@ describe("getFiltersByMappingStatus", () => {
expect.arrayContaining(["areaColorIri", "symbolColorIri"])
);
});

it("should correctly retrieve filters when using joinBy dimension", () => {
const config = {
chartType: "line-dual",
cubes: [
{
iri: "fo1",
filters: {},
joinBy: "X1",
},
{
iri: "foo2",
filters: {},
joinBy: "X2",
},
],
fields: {
x: {
componentIri: "joinBy",
},
},
} as any as ComboLineDualConfig;

const { mappedFiltersIris } = getFiltersByMappingStatus(config, {
cubeIri: "foo",
joinByIris: ["X1", "X2"],
});

// If the joinBy dimensions are treated as being mapped, we won't apply
// single filters to them when deriving filters from fields.
expect([...mappedFiltersIris]).toEqual(
expect.arrayContaining(["X1", "X2"])
);
});
});

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

0 comments on commit df5db9d

Please sign in to comment.