From 54ceae13f526e3364a8e30cb02bf2a828fef4927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raimund=20Schl=C3=BC=C3=9Fler?= Date: Wed, 30 Oct 2019 21:02:23 +0100 Subject: [PATCH] =?UTF-8?q?Add=20test=20for=20all=20view=20Signed-off-by:?= =?UTF-8?q?=20Raimund=20Schl=C3=BC=C3=9Fler=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../unit/components/TheCollections/General.spec.js | 11 ++++++++++- tests/javascript/unit/setupStore.js | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/javascript/unit/components/TheCollections/General.spec.js b/tests/javascript/unit/components/TheCollections/General.spec.js index b892a434..ffc514f2 100644 --- a/tests/javascript/unit/components/TheCollections/General.spec.js +++ b/tests/javascript/unit/components/TheCollections/General.spec.js @@ -18,6 +18,15 @@ describe('General.vue', () => { expect(wrapper.vm.calendars.length).toBe(2) }) + it('Checks that only uncompleted tasks show in the all view', () => { + const wrapper = mount(General, { localVue, store, router }) + if (wrapper.vm.$route.params.collectionId !== 'all') { + 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) + }) + it('Checks that we get the correct number of calendars for the starred view', () => { const wrapper = mount(General, { localVue, store, router }) if (wrapper.vm.$route.params.collectionId !== 'starred') { @@ -47,6 +56,6 @@ describe('General.vue', () => { if (wrapper.vm.$route.params.collectionId !== 'completed') { router.push({ name: 'collections', params: { collectionId: 'completed' } }) } - expect(wrapper.vm.filteredCalendars.length).toBe(0) + expect(wrapper.vm.filteredCalendars.length).toBe(1) }) }) diff --git a/tests/javascript/unit/setupStore.js b/tests/javascript/unit/setupStore.js index 249c34d5..214a47f3 100644 --- a/tests/javascript/unit/setupStore.js +++ b/tests/javascript/unit/setupStore.js @@ -53,6 +53,9 @@ 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 END:VTODO\n END:VCALENDAR`, `