Skip to content

Commit

Permalink
Add simple test for today view
Browse files Browse the repository at this point in the history
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
  • Loading branch information
raimund-schluessler committed Nov 2, 2019
1 parent d534040 commit 285aaac
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/javascript/unit/components/TheCollections/General.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
})

/*
Expand Down
5 changes: 5 additions & 0 deletions tests/javascript/unit/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
});
1 change: 1 addition & 0 deletions tests/javascript/unit/setupStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
`
Expand Down

0 comments on commit 285aaac

Please sign in to comment.