Test initial route

Add a test case to assert that the initial route is set to /all when the
app loads.
parent 72c4adbc
import { GlSprintf } from '@gitlab/ui';
import { GlSprintf, GlTabs } from '@gitlab/ui';
import { merge } from 'lodash';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import OnDemandScans from 'ee/on_demand_scans/components/on_demand_scans.vue';
......@@ -17,6 +17,7 @@ describe('OnDemandScans', () => {
// Finders
const findNewScanLink = () => wrapper.findByTestId('new-scan-link');
const findHelpPageLink = () => wrapper.findByTestId('help-page-link');
const findTabs = () => wrapper.findComponent(GlTabs);
const findAllTab = () => wrapper.findComponent(AllTab);
const findEmptyState = () => wrapper.findComponent(EmptyState);
......@@ -32,6 +33,7 @@ describe('OnDemandScans', () => {
stubs: {
ConfigurationPageLayout,
GlSprintf,
GlTabs,
},
},
options,
......@@ -81,5 +83,10 @@ describe('OnDemandScans', () => {
it('renders the tabs', () => {
expect(findAllTab().exists()).toBe(true);
});
it('sets the initial route to /all', () => {
expect(findTabs().props('value')).toBe(0);
expect(router.currentRoute.path).toBe('/all');
});
});
});
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