Updated unit tests
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
bb80621890
commit
bc7c288742
|
@ -18,9 +18,14 @@ describe('Component vnChip', () => {
|
|||
it(`should emit remove event`, () => {
|
||||
controller.emit = () => {};
|
||||
jest.spyOn(controller, 'emit');
|
||||
controller.onRemove();
|
||||
|
||||
expect(controller.emit).toHaveBeenCalledWith('remove');
|
||||
const $event = new Event('click');
|
||||
const target = document.createElement('div');
|
||||
target.dispatchEvent($event);
|
||||
|
||||
controller.onRemove($event);
|
||||
|
||||
expect(controller.emit).toHaveBeenCalledWith('remove', {$event});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -113,5 +113,21 @@ describe('Component vnWorkerTimeControl', () => {
|
|||
expect(result).toEqual('01:00');
|
||||
});
|
||||
});
|
||||
|
||||
describe('save() ', () => {
|
||||
it(`should make a query an then call to the fetchHours() method`, () => {
|
||||
controller.fetchHours = jest.fn();
|
||||
controller.selectedRow = {id: 1, timed: new Date(), direction: 'in'};
|
||||
controller.$.editEntry = {
|
||||
hide: () => {}
|
||||
};
|
||||
const expectedParams = {direction: 'in'};
|
||||
$httpBackend.expect('POST', 'WorkerTimeControls/1/updateTimeEntry', expectedParams).respond(200);
|
||||
controller.save();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.fetchHours).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue