Commit 558c19ec authored by Martin Wortschack's avatar Martin Wortschack

Merge branch 'ek-vsa-base-speci-minor-reorganization' into 'master'

VSA base spec minor reorganization

See merge request gitlab-org/gitlab!42329
parents 485a0b98 1301ac5c
......@@ -191,7 +191,6 @@ describe('Cycle Analytics component', () => {
expect(wrapper.find(ValueStreamSelect).exists()).toBe(flag);
};
describe('displays the components as required', () => {
describe('without a group', () => {
beforeEach(async () => {
const { group, ...stateWithoutGroup } = initialCycleAnalyticsState;
......@@ -250,21 +249,88 @@ describe('Cycle Analytics component', () => {
});
});
describe('with a group', () => {
describe('the user does not have access to the group', () => {
beforeEach(async () => {
mock = new MockAdapter(axios);
mockRequiredRoutes(mock);
wrapper = await createComponent({
featureFlags: {
hasPathNavigation: true,
},
});
await store.dispatch('receiveCycleAnalyticsDataError', {
response: { status: httpStatusCodes.FORBIDDEN },
});
});
it('renders the no access information', () => {
const emptyState = wrapper.find(GlEmptyState);
expect(emptyState.exists()).toBe(true);
expect(emptyState.props('svgPath')).toBe(noAccessSvgPath);
});
it('does not display the projects filter', () => {
displaysProjectsDropdownFilter(false);
});
it('does not display the date range picker', () => {
displaysDateRangePicker(false);
});
it('does not display the metrics', () => {
displaysMetrics(false);
});
it('does not display the stage table', () => {
displaysStageTable(false);
});
it('does not display the add stage button', () => {
displaysAddStageButton(false);
});
it('does not display the tasks by type chart', () => {
displaysTypeOfWork(false);
});
it('does not display the duration chart', () => {
displaysDurationChart(false);
});
describe('path navigation', () => {
describe('disabled', () => {
it('does not display the path navigation', () => {
displaysPathNavigation(false);
});
});
describe('enabled', () => {
beforeEach(async () => {
wrapper = await createComponent({
withValueStreamSelected: false,
withStageSelected: true,
pathNavigationEnabled: true,
});
mock = new MockAdapter(axios);
mockRequiredRoutes(mock);
mock.onAny().reply(httpStatusCodes.FORBIDDEN);
await waitForPromises();
});
afterEach(() => {
wrapper.destroy();
mock.restore();
wrapper = null;
});
it('does not display the path navigation', () => {
displaysPathNavigation(false);
});
});
});
});
describe('the user has access to the group', () => {
......@@ -279,6 +345,12 @@ describe('Cycle Analytics component', () => {
});
});
afterEach(() => {
wrapper.destroy();
mock.restore();
wrapper = null;
});
it('hides the empty state', () => {
expect(wrapper.find(GlEmptyState).exists()).toBe(false);
});
......@@ -467,83 +539,6 @@ describe('Cycle Analytics component', () => {
});
});
});
describe('the user does not have access to the group', () => {
beforeEach(async () => {
await store.dispatch('receiveCycleAnalyticsDataError', {
response: { status: httpStatusCodes.FORBIDDEN },
});
});
it('renders the no access information', () => {
const emptyState = wrapper.find(GlEmptyState);
expect(emptyState.exists()).toBe(true);
expect(emptyState.props('svgPath')).toBe(noAccessSvgPath);
});
it('does not display the projects filter', () => {
displaysProjectsDropdownFilter(false);
});
it('does not display the date range picker', () => {
displaysDateRangePicker(false);
});
it('does not display the metrics', () => {
displaysMetrics(false);
});
it('does not display the stage table', () => {
displaysStageTable(false);
});
it('does not display the add stage button', () => {
displaysAddStageButton(false);
});
it('does not display the tasks by type chart', () => {
displaysTypeOfWork(false);
});
it('does not display the duration chart', () => {
displaysDurationChart(false);
});
describe('path navigation', () => {
describe('disabled', () => {
it('does not display the path navigation', () => {
displaysPathNavigation(false);
});
});
describe('enabled', () => {
beforeEach(async () => {
wrapper = await createComponent({
withValueStreamSelected: false,
withStageSelected: true,
pathNavigationEnabled: true,
});
mock = new MockAdapter(axios);
mockRequiredRoutes(mock);
mock.onAny().reply(httpStatusCodes.FORBIDDEN);
await waitForPromises();
});
afterEach(() => {
mock.restore();
});
it('does not display the path navigation', () => {
displaysPathNavigation(false);
});
});
});
});
});
});
});
describe('with failed requests while loading', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment