Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/monitoring/pages/dashboard_page_spec.js')
-rw-r--r--spec/frontend/monitoring/pages/dashboard_page_spec.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/frontend/monitoring/pages/dashboard_page_spec.js b/spec/frontend/monitoring/pages/dashboard_page_spec.js
new file mode 100644
index 00000000000..e3c56ef4cbf
--- /dev/null
+++ b/spec/frontend/monitoring/pages/dashboard_page_spec.js
@@ -0,0 +1,36 @@
+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';
+
+describe('monitoring/pages/dashboard_page', () => {
+ let wrapper;
+
+ const buildWrapper = (props = {}) => {
+ wrapper = shallowMount(DashboardPage, {
+ propsData: {
+ ...props,
+ },
+ });
+ };
+
+ const findDashboardComponent = () => wrapper.find(Dashboard);
+
+ afterEach(() => {
+ if (wrapper) {
+ wrapper.destroy();
+ wrapper = null;
+ }
+ });
+
+ it('throws errors if dashboard props are not passed', () => {
+ expect(() => buildWrapper()).toThrow('Missing required prop: "dashboardProps"');
+ });
+
+ it('renders the dashboard page with dashboard component', () => {
+ buildWrapper({ dashboardProps: propsData });
+
+ expect(findDashboardComponent().props()).toMatchObject(propsData);
+ expect(findDashboardComponent()).toExist();
+ });
+});