diff --git a/e2e/helpers/puppeteer.js b/e2e/helpers/puppeteer.js index dace276be..abd76b434 100644 --- a/e2e/helpers/puppeteer.js +++ b/e2e/helpers/puppeteer.js @@ -27,7 +27,7 @@ export async function getBrowser() { args, defaultViewport: null, headless: headless, - slowMo: 5, // slow down by ms + slowMo: 1, // slow down by ms // ignoreDefaultArgs: ['--disable-extensions'], // executablePath: '/usr/bin/google-chrome-stable', // executablePath: '/usr/bin/firefox-developer-edition', diff --git a/modules/worker/front/time-control/index.spec.js b/modules/worker/front/time-control/index.spec.js index 920f13e7c..39a47c47f 100644 --- a/modules/worker/front/time-control/index.spec.js +++ b/modules/worker/front/time-control/index.spec.js @@ -129,5 +129,28 @@ describe('Component vnWorkerTimeControl', () => { expect(controller.fetchHours).toHaveBeenCalledWith(); }); }); + + describe('$postLink() ', () => { + it(`should set the controller date as today if no timestamp is defined`, () => { + controller.$.model = {applyFilter: jest.fn().mockReturnValue(Promise.resolve())}; + controller.$params = {timestamp: undefined}; + controller.$postLink(); + + expect(controller.date).toEqual(jasmine.any(Date)); + }); + + it(`should set the controller date using the received timestamp`, () => { + const date = 'Wed, 31 Dec 1969 23:00:00 GMT'; + const timestamp = 1; + + controller.$.model = {applyFilter: jest.fn().mockReturnValue(Promise.resolve())}; + controller.$.calendar = {}; + controller.$params = {timestamp: timestamp}; + + controller.$postLink(); + + expect(controller.date.toUTCString()).toEqual(date); + }); + }); }); });