Add tests

Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
This commit is contained in:
Raimund Schlüßler 2019-05-29 21:07:54 +02:00
parent 97a4addc2f
commit 4f07897580
No known key found for this signature in database
GPG key ID: 036FA7EB1A599178
3 changed files with 16 additions and 0 deletions

6
package-lock.json generated
View file

@ -11158,6 +11158,12 @@
}
}
},
"mockdate": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/mockdate/-/mockdate-2.0.5.tgz",
"integrity": "sha512-ST0PnThzWKcgSLyc+ugLVql45PvESt3Ul/wrdV/OPc/6Pr8dbLAIJsN1cIp41FLzbN+srVTNIRn+5Cju0nyV6A==",
"dev": true
},
"moment": {
"version": "2.24.0",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz",

View file

@ -75,6 +75,8 @@
"jest-serializer-vue": "^2.0.2",
"jsdom": "^15.1.1",
"jsdom-global": "^3.0.2",
"mockdate": "2.0.5",
"moment": "^2.24.0",
"node-sass": "^4.13.0",
"prettier-eslint": "^9.0.0",
"raw-loader": "^3.1.0",

View file

@ -1,4 +1,5 @@
import moment from 'moment'
import MockDate from 'mockdate'
import { sort } from '../../src/store/storeHelper'
global.moment = moment
@ -38,4 +39,11 @@ describe('storeHelper', () => {
const receivedTasks = sort(clonedTasks, 'due', 1)
expect(receivedTasks).toEqual(expectedTasks)
})
it("Tests if correct tasks are found for the 'current' collection.", () => {
// Set date to fixed value
MockDate.set(moment('20190101T123456', 'YYYYMMDDTHHmmss'))
MockDate.reset()
})
})