diff --git a/package-lock.json b/package-lock.json index 2ebd22df..3bed76fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 87f494d4..49e2dfff 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/tests/store/storeHelper.spec.js b/tests/store/storeHelper.spec.js index ddedd5ef..57131907 100644 --- a/tests/store/storeHelper.spec.js +++ b/tests/store/storeHelper.spec.js @@ -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() + }) })