Add tests
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
This commit is contained in:
parent
97a4addc2f
commit
4f07897580
3 changed files with 16 additions and 0 deletions
6
package-lock.json
generated
6
package-lock.json
generated
|
@ -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": {
|
"moment": {
|
||||||
"version": "2.24.0",
|
"version": "2.24.0",
|
||||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz",
|
"resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz",
|
||||||
|
|
|
@ -75,6 +75,8 @@
|
||||||
"jest-serializer-vue": "^2.0.2",
|
"jest-serializer-vue": "^2.0.2",
|
||||||
"jsdom": "^15.1.1",
|
"jsdom": "^15.1.1",
|
||||||
"jsdom-global": "^3.0.2",
|
"jsdom-global": "^3.0.2",
|
||||||
|
"mockdate": "2.0.5",
|
||||||
|
"moment": "^2.24.0",
|
||||||
"node-sass": "^4.13.0",
|
"node-sass": "^4.13.0",
|
||||||
"prettier-eslint": "^9.0.0",
|
"prettier-eslint": "^9.0.0",
|
||||||
"raw-loader": "^3.1.0",
|
"raw-loader": "^3.1.0",
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
|
import MockDate from 'mockdate'
|
||||||
import { sort } from '../../src/store/storeHelper'
|
import { sort } from '../../src/store/storeHelper'
|
||||||
|
|
||||||
global.moment = moment
|
global.moment = moment
|
||||||
|
@ -38,4 +39,11 @@ describe('storeHelper', () => {
|
||||||
const receivedTasks = sort(clonedTasks, 'due', 1)
|
const receivedTasks = sort(clonedTasks, 'due', 1)
|
||||||
expect(receivedTasks).toEqual(expectedTasks)
|
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()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue