diff --git a/app/configurator/configurator-state.spec.tsx b/app/configurator/configurator-state.spec.tsx index 2a3fec9ad3..c4928ebb8f 100644 --- a/app/configurator/configurator-state.spec.tsx +++ b/app/configurator/configurator-state.spec.tsx @@ -17,12 +17,10 @@ import { applyTableDimensionToFilters, deriveFiltersFromFields, getFiltersByMappingStatus, - getLocalStorageKey, handleChartFieldChanged, handleChartOptionChanged, initChartStateFromChart, initChartStateFromCube, - initChartStateFromLocalStorage, moveFilterField, updateColorMapping, } from "@/configurator/configurator-state"; @@ -86,7 +84,9 @@ afterEach(() => { describe("initChartStateFromChart", () => { const setup = ({ chartConfig }: { chartConfig: object }) => { - mockedApi.fetchChartConfig.mockResolvedValue(chartConfig); + mockedApi.fetchChartConfig.mockResolvedValue( + chartConfig as ReturnType + ); }; it("should fetch work if existing chart is valid", async () => { setup({ @@ -112,27 +112,6 @@ describe("initChartStateFromChart", () => { }); }); -describe("initChartFromLocalStorage", () => { - it("should initialize from localStorage if valid", async () => { - localStorage.setItem( - getLocalStorageKey("viz1234"), - JSON.stringify({ state: "CONFIGURING_CHART", ...fakeVizFixture }) - ); - const state = await initChartStateFromLocalStorage("viz1234"); - expect(state).not.toBeUndefined(); - }); - - it("should return undefined and remove key from localStorage if invalid", async () => { - jest.spyOn(console, "warn").mockImplementation(() => {}); - jest.spyOn(console, "error").mockImplementation(() => {}); - - localStorage.setItem(getLocalStorageKey("viz1234"), "abcde"); - const state = await initChartStateFromLocalStorage("viz1234"); - expect(state).toBeUndefined(); - expect(localStorage.getItem(getLocalStorageKey("viz1234"))).toBe(null); - }); -}); - describe("initChartStateFromCube", () => { const setup = ({ cubeMetadata }: { cubeMetadata: object }) => { const client = new Client({ diff --git a/app/configurator/configurator-state.tsx b/app/configurator/configurator-state.tsx index 4edd2f8ecc..7e96f86614 100644 --- a/app/configurator/configurator-state.tsx +++ b/app/configurator/configurator-state.tsx @@ -257,10 +257,6 @@ export type ConfiguratorStateAction = export type ActionType = ConfiguratorStateAction[keyof ConfiguratorStateAction]; -const LOCALSTORAGE_PREFIX = "vizualize-configurator-state"; -export const getLocalStorageKey = (chartId: string) => - `${LOCALSTORAGE_PREFIX}:${chartId}`; - const getStateWithCurrentDataSource = (state: ConfiguratorState) => { const dataSource = getDataSourceFromLocalStorage();