From c3f8e0d056864df8bb6d89de8be6846f5246a28a Mon Sep 17 00:00:00 2001 From: gaoruoshu Date: Sun, 21 Mar 2021 16:50:41 +0800 Subject: [PATCH] add testcase for each page --- tests/analysis.vue.test.js | 25 +++++++++++++++++++++++ tests/error.vue.test.js | 17 ++++++++++++++++ tests/index.vue.test.js | 17 ++++++++++++++++ tests/layout.vue.test.js | 36 +++++++++++++++++++++++++++++++++ tests/login-layout.vue.test.js | 37 ++++++++++++++++++++++++++++++++++ tests/login.vue.test.js | 23 +++++++++++++++++++++ tests/tuning.vue.test.js | 29 ++++++++++++++++++++++++++ 7 files changed, 184 insertions(+) create mode 100644 tests/analysis.vue.test.js create mode 100644 tests/error.vue.test.js create mode 100644 tests/index.vue.test.js create mode 100644 tests/layout.vue.test.js create mode 100644 tests/login-layout.vue.test.js create mode 100644 tests/login.vue.test.js create mode 100644 tests/tuning.vue.test.js diff --git a/tests/analysis.vue.test.js b/tests/analysis.vue.test.js new file mode 100644 index 0000000..d66a707 --- /dev/null +++ b/tests/analysis.vue.test.js @@ -0,0 +1,25 @@ +import { mountQuasar } from '@quasar/quasar-app-extension-testing-unit-jest'; +import { QPage, QCard, QTabPanel, QBtn, QForm, QInput } from 'quasar'; +import Analysis from '../src/pages/Analysis'; + +describe('Analysis', () => { + test('initial analysis page', () => { + window.localStorage.setItem('userId', 1); + const wrapper = mountQuasar(Analysis, { + quasar: { + components: { + QPage, + QCard, + QTabPanel, + QBtn, + QForm, + QInput + }, + }, + propsData: { + + }, + }); + expect(wrapper).toBeTruthy(); + }); +}); \ No newline at end of file diff --git a/tests/error.vue.test.js b/tests/error.vue.test.js new file mode 100644 index 0000000..24cbb6e --- /dev/null +++ b/tests/error.vue.test.js @@ -0,0 +1,17 @@ +import { mountQuasar } from '@quasar/quasar-app-extension-testing-unit-jest'; +import { QBtn } from 'quasar'; +import Error from '../src/pages/Error404'; + +describe('Error', () => { + test('initial error page', () => { + const wrapper = mountQuasar(Error, { + quasar: { + components: { + QBtn, + }, + }, + propsData: {}, + }); + expect(wrapper).toBeTruthy(); + }); +}); \ No newline at end of file diff --git a/tests/index.vue.test.js b/tests/index.vue.test.js new file mode 100644 index 0000000..470386d --- /dev/null +++ b/tests/index.vue.test.js @@ -0,0 +1,17 @@ +import { mountQuasar } from '@quasar/quasar-app-extension-testing-unit-jest'; +import { QPage } from 'quasar'; +import Index from '../src/pages/Index'; + +describe('Index', () => { + test('initial Index page', () => { + const wrapper = mountQuasar(Index, { + quasar: { + components: { + QPage, + }, + }, + propsData: {}, + }); + expect(wrapper).toBeTruthy(); + }); +}); diff --git a/tests/layout.vue.test.js b/tests/layout.vue.test.js new file mode 100644 index 0000000..7261205 --- /dev/null +++ b/tests/layout.vue.test.js @@ -0,0 +1,36 @@ +import { mountQuasar } from '@quasar/quasar-app-extension-testing-unit-jest'; +import { QLayout, QHeader, QToolbar, QBtn, QToolbarTitle, QInput, QIcon, QBtnDropdown, + QList, QItem, QItemSection, QItemLabel, QDrawer, QScrollArea, QSeparator, + QPageContainer, QTooltip } from 'quasar'; +import { VRipple } from '@vue/test-utils'; +import Layout from '../src/layouts/Layout'; + +describe('Layout', () => { + test('initial layout', () => { + const wrapper = mountQuasar(Layout, { + quasar: { + components: { + QLayout, + QHeader, + QToolbar, + QBtn, + QToolbarTitle, + QInput, + QIcon, + QBtnDropdown, + QList, + QItem, + QItemSection, + QItemLabel, + QDrawer, + QScrollArea, + QSeparator, + QPageContainer, + QTooltip, + }, + }, + propsData: {}, + }); + expect(wrapper).toBeTruthy(); + }); +}); diff --git a/tests/login-layout.vue.test.js b/tests/login-layout.vue.test.js new file mode 100644 index 0000000..3888f8a --- /dev/null +++ b/tests/login-layout.vue.test.js @@ -0,0 +1,37 @@ +import { mountQuasar } from '@quasar/quasar-app-extension-testing-unit-jest'; +import { QHeader, QBtn, QToolbar, QToolbarTitle, QBtnDropdown, QLayout, QTooltip, + QItem, QItemSection, QDrawer, QIcon, QSeparator, QPageContainer, QCardActions, + QInput, QForm, QCardSection, QCard, QPage } from 'quasar'; +import Login from '../src/layouts/Login'; + +describe('Layout-Login', () => { + test('initial login layout', () => { + const wrapper = mountQuasar(Login, { + quasar: { + components: { + QHeader, + QBtn, + QToolbar, + QToolbarTitle, + QBtnDropdown, + QLayout, + QTooltip, + QItem, + QItemSection, + QDrawer, + QIcon, + QSeparator, + QPageContainer, + QCardActions, + QInput, + QForm, + QCardSection, + QCard, + QPage + }, + }, + propsData: {}, + }); + expect(wrapper).toBeTruthy(); + }); +}); diff --git a/tests/login.vue.test.js b/tests/login.vue.test.js new file mode 100644 index 0000000..383b910 --- /dev/null +++ b/tests/login.vue.test.js @@ -0,0 +1,23 @@ +import { mountQuasar } from '@quasar/quasar-app-extension-testing-unit-jest'; +import { QPage, QCard, QCardActions, QCardSection, QForm, QInput, QBtn } from 'quasar'; +import Login from '../src/pages/Login'; + +describe('Login', () => { + test('initial login page', () => { + const wrapper = mountQuasar(Login, { + quasar: { + components: { + QPage, + QCard, + QCardActions, + QCardSection, + QForm, + QInput, + QBtn, + }, + }, + propsData: {}, + }); + expect(wrapper).toBeTruthy(); + }); +}); diff --git a/tests/tuning.vue.test.js b/tests/tuning.vue.test.js new file mode 100644 index 0000000..7d2e5d5 --- /dev/null +++ b/tests/tuning.vue.test.js @@ -0,0 +1,29 @@ +import { mountQuasar } from '@quasar/quasar-app-extension-testing-unit-jest'; +import { QBtn, QPage, QCard, QTabs, QTab, QSeparator, QTabPanels, QTabPanel, QForm, QInput } from 'quasar'; +import Tuning from '../src/pages/Tuning'; + +describe('Tuning', () => { + test('initial tuning page', () => { + window.localStorage.setItem('userId', 1); + const wrapper = mountQuasar(Tuning, { + quasar: { + components: { + QBtn, + QPage, + QCard, + QTabs, + QTab, + QSeparator, + QTabPanels, + QTabPanel, + QForm, + QInput + }, + }, + propsData: { + + }, + }); + expect(wrapper).toBeTruthy(); + }); +}); -- Gitee