Commit 20915674 authored by Miguel Rincon's avatar Miguel Rincon

Remove mock props data

Remove manually input mock data in favor of data from a fixture
parent 879d1679
......@@ -5,23 +5,6 @@ import { TEST_HOST } from '../helpers/test_constants';
export const mockProjectDir = '/frontend-fixtures/environments-project';
export const mockApiEndpoint = `${TEST_HOST}/monitoring/mock`;
export const propsData = {
hasMetrics: false,
documentationPath: '/path/to/docs',
settingsPath: '/path/to/settings',
clustersPath: '/path/to/clusters',
tagsPath: '/path/to/tags',
defaultBranch: 'master',
emptyGettingStartedSvgPath: '/path/to/getting-started.svg',
emptyLoadingSvgPath: '/path/to/loading.svg',
emptyNoDataSvgPath: '/path/to/no-data.svg',
emptyNoDataSmallSvgPath: '/path/to/no-data-small.svg',
emptyUnableToConnectSvgPath: '/path/to/unable-to-connect.svg',
customMetricsAvailable: false,
customMetricsPath: '',
validateQueryPath: '',
};
export const customDashboardBasePath = '.gitlab/dashboards';
const customDashboardsData = new Array(30).fill(null).map((_, idx) => ({
......
import { shallowMount } from '@vue/test-utils';
import DashboardPage from '~/monitoring/pages/dashboard_page.vue';
import Dashboard from '~/monitoring/components/dashboard.vue';
import { propsData } from '../mock_data';
import { dashboardProps } from '../fixture_data';
describe('monitoring/pages/dashboard_page', () => {
let wrapper;
......@@ -28,9 +28,18 @@ describe('monitoring/pages/dashboard_page', () => {
});
it('renders the dashboard page with dashboard component', () => {
buildWrapper({ dashboardProps: propsData });
buildWrapper({ dashboardProps });
const allProps = {
...dashboardProps,
// default props values
rearrangePanelsAvailable: false,
showHeader: true,
showPanels: true,
smallEmptyState: false,
};
expect(findDashboardComponent().props()).toMatchObject(propsData);
expect(findDashboardComponent()).toExist();
expect(allProps).toMatchObject(findDashboardComponent().props());
});
});
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