From a80b78d9465b367d40ae1e39e02e36b367462123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raimund=20Schl=C3=BC=C3=9Fler?= Date: Sat, 2 Nov 2019 22:21:34 +0100 Subject: =?UTF-8?q?Add=20simple=20test=20for=20today=20view=20Signed-off-b?= =?UTF-8?q?y:=20Raimund=20Schl=C3=BC=C3=9Fler=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../javascript/unit/components/TheCollections/General.spec.js | 10 +++++++++- tests/javascript/unit/setup.js | 5 +++++ tests/javascript/unit/setupStore.js | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/javascript/unit/components/TheCollections/General.spec.js b/tests/javascript/unit/components/TheCollections/General.spec.js index 213eb5d3..1c9e54cf 100644 --- a/tests/javascript/unit/components/TheCollections/General.spec.js +++ b/tests/javascript/unit/components/TheCollections/General.spec.js @@ -88,7 +88,15 @@ describe('General.vue', () => { if (wrapper.vm.$route.params.collectionId !== 'today') { router.push({ name: 'collections', params: { collectionId: 'today' } }) } - expect(wrapper.vm.filteredCalendars.length).toBe(0) + expect(wrapper.vm.filteredCalendars.length).toBe(1) + }) + + it('Checks that only today tasks show in the today view', () => { + const wrapper = mount(General, { localVue, store, router }) + if (wrapper.vm.$route.params.collectionId !== 'today') { + router.push({ name: 'collections', params: { collectionId: 'today' } }) + } + expect(wrapper.find('li[task-id="pwen4kz18g.ics"]').exists()).toBe(true) // Already due --> shown }) /* diff --git a/tests/javascript/unit/setup.js b/tests/javascript/unit/setup.js index 6f72d3d1..47121071 100644 --- a/tests/javascript/unit/setup.js +++ b/tests/javascript/unit/setup.js @@ -22,6 +22,11 @@ VueTestUtils.config.mocks.$n = function(app, singular, plural, count) { VueTestUtils.config.mocks.n = VueTestUtils.config.mocks.$n global.n = VueTestUtils.config.mocks.$n +global.OCA = {} +global.OCA.Tasks = {} +global.OCA.Tasks.$t = VueTestUtils.config.mocks.$t +global.OCA.Tasks.$n = VueTestUtils.config.mocks.$n + afterAll(() => { MockDate.reset() }); diff --git a/tests/javascript/unit/setupStore.js b/tests/javascript/unit/setupStore.js index 9f8a3c2e..4c76c2fc 100644 --- a/tests/javascript/unit/setupStore.js +++ b/tests/javascript/unit/setupStore.js @@ -40,6 +40,7 @@ LAST-MODIFIED:20190918T095816\n UID:pwen4kz18g\n SUMMARY:Calendar 1 - Task 1\n PRIORITY:1\n +DUE:20190101T123400\n END:VTODO\n END:VCALENDAR`, ` -- cgit v1.2.3