test(worker_time-control): tested url parameter timestamp
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2021-11-29 15:22:16 +01:00
parent 07e092f9bd
commit 85e3b47408
2 changed files with 24 additions and 1 deletions

View File

@ -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',

View File

@ -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);
});
});
});
});