Skip to content

Commit

Permalink
unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Creighton <[email protected]>
  • Loading branch information
creightonfrance committed Sep 23, 2024
1 parent 31004b9 commit 2aa3829
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/javascript/unit/views/AppSidebar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,39 @@ describe('AppSidebar.vue', () => {
actual = wrapper.vm.newDueDate
expect(actual.getTime()).toBe(newDueDate.getTime())
})

it('Task completed date is set correctly', () => {
const wrapper = shallowMount(AppSidebar, {
global: {
plugins: [store, router],
},
})

let actual = wrapper.vm.newCompletedDate
expect(actual).toBe(null)

const newCompletedDate = new Date('2019-01-01T12:00:00')
wrapper.vm.changeCompletedDate({ task: wrapper.vm.task, value: newCompletedDate })

Check failure on line 71 in tests/javascript/unit/views/AppSidebar.spec.js

View workflow job for this annotation

GitHub Actions / NPM lint

Trailing spaces not allowed
actual = wrapper.vm.newCompletedDate
expect(actual.getTime()).toBe(newCompletedDate.getTime())
})

it('Setting completed date to future is ignored', () => {
const wrapper = shallowMount(AppSidebar, {
global: {
plugins: [store, router],
},
})

let actual = wrapper.vm.newCompletedDate
const expected = new Date('2019-01-01T12:00:00')
expect(actual.getTime()).toBe(expected.getTime())

const newCompletedDate = new Date('2020-01-01T12:00:01')
wrapper.vm.changeCompletedDate({ task: wrapper.vm.task, value: newCompletedDate })

actual = wrapper.vm.newCompletedDate
expect(actual.getTime()).toBe(expected.getTime())
})
})

0 comments on commit 2aa3829

Please sign in to comment.