Skip to content
Snippets Groups Projects

fix(submaps tabs): fixed duplicated mainmap tab on app init

Merged Tadeusz Miesiąc requested to merge bug/duplicated-main-map-tab into development
2 files
+ 48
2
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -5,7 +5,13 @@ import { BACKGROUNDS_MOCK, BACKGROUND_INITIAL_STATE_MOCK } from '../backgrounds/
import { RootState } from '../store';
import { INITIAL_STORE_STATE_MOCK } from '../root/root.fixtures';
import { MODELS_INITIAL_STATE_MOCK } from '../models/models.mock';
import { getBackgroundId, getInitMapPosition, getInitMapSizeAndModelId } from './map.thunks';
import {
getBackgroundId,
getInitMapPosition,
getInitMapSizeAndModelId,
getOpenedMaps,
} from './map.thunks';
import { initialMapDataFixture, initialMapStateFixture } from './map.fixtures';
const EMPTY_QUERY_DATA: QueryData = {
modelId: undefined,
@@ -112,4 +118,42 @@ describe('map thunks - utils', () => {
});
});
});
describe('getOpenedMaps ', () => {
it('should return main map only', () => {
const openedMaps = getOpenedMaps(
{
...STATE_WITH_MODELS,
map: { ...initialMapStateFixture, data: { ...initialMapDataFixture, modelId: 5053 } },
},
EMPTY_QUERY_DATA,
);
expect(openedMaps).toEqual([
{ lastPosition: { x: 0, y: 0, z: 0 }, modelId: 5053, modelName: 'Main map' },
]);
});
it('should return main map and opened submap', () => {
const openedMaps = getOpenedMaps(
{
...STATE_WITH_MODELS,
map: { ...initialMapStateFixture, data: { ...initialMapDataFixture, modelId: 5054 } },
},
EMPTY_QUERY_DATA,
);
expect(openedMaps).toEqual([
{ lastPosition: { x: 0, y: 0, z: 0 }, modelId: 5053, modelName: 'Main map' },
{
lastPosition: {
x: 0,
y: 0,
z: 0,
},
modelId: 5054,
modelName: 'PRKN substrates',
},
]);
});
});
});
Loading