From b33a08f6d34f7973f44f379608908b19369864d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raimund=20Schl=C3=BC=C3=9Fler?= Date: Sun, 3 Nov 2019 20:28:20 +0100 Subject: Add tests for completed view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raimund Schlüßler --- .../unit/components/TheCollections/General.spec.js | 11 ++++++++++- tests/javascript/unit/setupStore.js | 20 +++++++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/javascript/unit/components/TheCollections/General.spec.js b/tests/javascript/unit/components/TheCollections/General.spec.js index fad76e72..d0e7aa7e 100644 --- a/tests/javascript/unit/components/TheCollections/General.spec.js +++ b/tests/javascript/unit/components/TheCollections/General.spec.js @@ -27,7 +27,7 @@ describe('General.vue', () => { router.push({ name: 'collections', params: { collectionId: 'all' } }) } expect(wrapper.find('li[task-id="pwen4kz18g.ics"]').exists()).toBe(true) - expect(wrapper.find('li[task-id="pwen4kz19g.ics"]').exists()).toBe(false) + expect(wrapper.find('li[task-id="pwen4kz40g.ics"]').exists()).toBe(false) }) /* @@ -114,4 +114,13 @@ describe('General.vue', () => { } expect(wrapper.vm.filteredCalendars.length).toBe(1) }) + + it('Checks that only completed tasks show in the completed view', () => { + const wrapper = mount(General, { localVue, store, router }) + if (wrapper.vm.$route.params.collectionId !== 'completed') { + router.push({ name: 'collections', params: { collectionId: 'completed' } }) + } + expect(wrapper.find('li[task-id="pwen4kz19g.ics"]').exists()).toBe(false) // Not completed --> hidden + expect(wrapper.find('li[task-id="pwen4kz40g.ics"]').exists()).toBe(true) // Completed --> shown + }) }) diff --git a/tests/javascript/unit/setupStore.js b/tests/javascript/unit/setupStore.js index 232d1a22..9d398285 100644 --- a/tests/javascript/unit/setupStore.js +++ b/tests/javascript/unit/setupStore.js @@ -54,9 +54,6 @@ LAST-MODIFIED:20190918T095816\n UID:pwen4kz19g\n SUMMARY:Calendar 1 - Task 2\n PRIORITY:9\n -PERCENT-COMPLETE:100\n -STATUS:COMPLETED\n -COMPLETED:20190918T095816\n DTSTART:20190918T095816\n END:VTODO\n END:VCALENDAR`, @@ -143,6 +140,23 @@ PERCENT-COMPLETE:100\n STATUS:COMPLETED\n COMPLETED:20190918T095816\n END:VTODO\n +END:VCALENDAR`, +` +BEGIN:VCALENDAR\n +VERSION:2.0\n +PRODID:-//Nextcloud Tasks 0.11.3\n +BEGIN:VTODO\n +CREATED:20181119T183919\n +DTSTAMP:20190918T095816\n +LAST-MODIFIED:20190918T095816\n +UID:pwen4kz40g\n +SUMMARY:Calendar 1 - Task 2\n +PRIORITY:9\n +PERCENT-COMPLETE:100\n +STATUS:COMPLETED\n +COMPLETED:20190918T095816\n +DTSTART:20190918T095816\n +END:VTODO\n END:VCALENDAR` ], }, -- cgit v1.2.3