summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDevlin Junker <devlin.junker@gmail.com>2022-09-29 23:49:10 -0700
committerBenjamin Brahmer <info@b-brahmer.de>2022-11-02 11:27:20 +0100
commit08d12e500952dfca9730f6b4ab0255f3805f6452 (patch)
tree5a321ed7471a9eb69d87ea2405488c736f2b3872 /tests
parentfe62ff20112540abee74424680dbe70dfbbdb955 (diff)
running single test
Signed-off-by: Devlin Junker <devlin.junker@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/javascript/unit/components/Sidebar.spec.ts44
-rw-r--r--tests/javascript/unit/setup.ts30
-rw-r--r--tests/javascript/unit/setupStore.ts13
3 files changed, 87 insertions, 0 deletions
diff --git a/tests/javascript/unit/components/Sidebar.spec.ts b/tests/javascript/unit/components/Sidebar.spec.ts
new file mode 100644
index 000000000..d5a381479
--- /dev/null
+++ b/tests/javascript/unit/components/Sidebar.spec.ts
@@ -0,0 +1,44 @@
+/**
+ * Nextcloud - Tasks
+ *
+ * @author Raimund Schlüßler
+ *
+ * @copyright 2021 Raimund Schlüßler <raimund.schluessler@mailbox.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+import AppSidebar from 'Components/Sidebar.vue'
+
+import { store, localVue } from '../setupStore'
+
+import { shallowMount } from '@vue/test-utils'
+
+describe('Sidebar.vue', () => {
+ 'use strict'
+
+ // We set the route before mounting AppSidebar to prevent messages that the task was not found
+ // Could be adjusted with future tests
+ // router.push({ name: 'calendarsTask', params: { calendarId: 'calendar-1', taskId: 'pwen4kz18g.ics' } })
+
+ it('Returns the correct value for the new dates', () => {
+ const wrapper = shallowMount(AppSidebar, { localVue, store })
+
+ // eslint-disable-next-line no-console
+ console.log(wrapper.vm)
+ // let actual = wrapper.vm.newStartDate
+ // let expected = new Date('2019-01-01T12:00:00')
+ // expect(actual.getTime()).toBe(expected.getTime()
+ })
+})
diff --git a/tests/javascript/unit/setup.ts b/tests/javascript/unit/setup.ts
new file mode 100644
index 000000000..17fc5c058
--- /dev/null
+++ b/tests/javascript/unit/setup.ts
@@ -0,0 +1,30 @@
+// import { OC } from './OC.js'
+
+import { config } from '@vue/test-utils'
+// eslint-disable-next-line node/no-unpublished-import
+// import MockDate from 'mockdate'
+// eslint-disable-next-line node/no-unpublished-import
+// import 'regenerator-runtime/runtime'
+
+// Set date to fixed value
+// MockDate.set(new Date('2019-01-01T12:34:56'))
+
+// global.OC = new OC()
+
+// Mock nextcloud translate functions
+config.mocks.$t = function(_app: any, string: any) {
+ return string
+}
+config.mocks.t = config.mocks.$t
+// (global as any).t = config.mocks.$t
+
+config.mocks.$n = function(app: any, singular: any, plural: any, count: any) {
+ return singular
+}
+config.mocks.n = config.mocks.$n
+// (global as any).n = config.mocks.$n
+
+
+afterAll(() => {
+ // MockDate.reset()
+})
diff --git a/tests/javascript/unit/setupStore.ts b/tests/javascript/unit/setupStore.ts
new file mode 100644
index 000000000..31651ac42
--- /dev/null
+++ b/tests/javascript/unit/setupStore.ts
@@ -0,0 +1,13 @@
+
+import { createLocalVue } from '@vue/test-utils'
+import Vuex from 'vuex'
+// import router from '@/router.js'
+
+const localVue = createLocalVue()
+localVue.use(Vuex)
+
+const store = new Vuex.Store({
+ modules: {
+ },
+})
+export { store, localVue }