debian-mirror-gitlab/spec/frontend/cycle_analytics/store/getters_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-09-04 01:27:46 +05:30
import * as getters from '~/cycle_analytics/store/getters';
2021-11-18 22:05:49 +05:30
2021-09-04 01:27:46 +05:30
import {
allowedStages,
stageMedians,
transformedProjectStagePathData,
selectedStage,
2021-10-27 15:23:28 +05:30
stageCounts,
2021-11-18 22:05:49 +05:30
basePaginationResult,
initialPaginationState,
2021-09-04 01:27:46 +05:30
} from '../mock_data';
describe('Value stream analytics getters', () => {
2021-11-18 22:05:49 +05:30
let state = {};
2021-09-04 01:27:46 +05:30
describe('pathNavigationData', () => {
it('returns the transformed data', () => {
2021-11-18 22:05:49 +05:30
state = { stages: allowedStages, medians: stageMedians, selectedStage, stageCounts };
2021-09-04 01:27:46 +05:30
expect(getters.pathNavigationData(state)).toEqual(transformedProjectStagePathData);
});
});
2021-11-18 22:05:49 +05:30
describe('paginationParams', () => {
beforeEach(() => {
state = { pagination: initialPaginationState };
});
it('returns the `pagination` type', () => {
expect(getters.paginationParams(state)).toEqual(basePaginationResult);
});
it('returns the `sort` type', () => {
expect(getters.paginationParams(state)).toEqual(basePaginationResult);
});
it('with page=10, sets the `page` property', () => {
const page = 10;
state = { pagination: { ...initialPaginationState, page } };
expect(getters.paginationParams(state)).toEqual({ ...basePaginationResult, page });
});
});
2021-09-04 01:27:46 +05:30
});