Skip to content

Commit

Permalink
chore: Add joinBy iris migration test
Browse files Browse the repository at this point in the history
  • Loading branch information
bprusinowski committed Nov 20, 2024
1 parent ff730d9 commit 04eeb38
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions app/utils/chart-config/versioning.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import {
ConfiguratorStateConfiguringChart,
decodeChartConfig,
LineConfig,
TableConfig,
} from "@/config-types";
import { configJoinedCubes } from "@/configurator/configurator-state/mocks";
import { stringifyComponentId } from "@/graphql/make-component-id";
import dualLine1Fixture from "@/test/__fixtures/config/dev/chartConfig-photovoltaik-und-gebaudeprogramm.json";
import tableFixture from "@/test/__fixtures/config/dev/chartConfig-table-covid19.json";
Expand Down Expand Up @@ -197,14 +199,25 @@ describe("config migrations", () => {
});
});

it("should correctly migrate table charts to v4.0.0", async () => {
it("should correctly migrate table charts", async () => {
const migratedConfig = await migrateChartConfig(tableFixture, {
toVersion: "4.0.0",
toVersion: CHART_CONFIG_VERSION,
migrationProps: CONFIGURATOR_STATE,
});
const decodedConfig = decodeChartConfig(migratedConfig);
expect(decodedConfig).toBeDefined();
});

it("should not migrate joinBy iris", async () => {
const migratedConfig = await migrateChartConfig(configJoinedCubes.table, {
toVersion: CHART_CONFIG_VERSION,
migrationProps: CONFIGURATOR_STATE,
});
const decodedConfig = decodeChartConfig(migratedConfig) as TableConfig;
expect(decodedConfig).toBeDefined();
expect(Object.keys(decodedConfig.fields)[0]).toBe("joinBy__0");
expect(decodedConfig.fields["joinBy__0"].componentId).toBe("joinBy__0");
});
});

describe("last version", () => {
Expand Down

0 comments on commit 04eeb38

Please sign in to comment.