Updated unit test
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
ddf5993277
commit
895fd4c9e8
|
@ -14,20 +14,6 @@ describe('Travel Component vnTravelExtraCommunity', () => {
|
||||||
controller.$.model.refresh = jest.fn();
|
controller.$.model.refresh = jest.fn();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('changeReference()', () => {
|
|
||||||
it('should make an HTTP query', () => {
|
|
||||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
|
||||||
|
|
||||||
const travel = {id: 1, ref: 'New reference'};
|
|
||||||
const expectedData = {ref: 'New reference'};
|
|
||||||
$httpBackend.expect('PATCH', `Travels/${travel.id}`, expectedData).respond(200);
|
|
||||||
controller.changeReference(travel);
|
|
||||||
$httpBackend.flush();
|
|
||||||
|
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('findDraggable()', () => {
|
describe('findDraggable()', () => {
|
||||||
it('should find the draggable element', () => {
|
it('should find the draggable element', () => {
|
||||||
const draggable = document.createElement('a');
|
const draggable = document.createElement('a');
|
||||||
|
@ -124,4 +110,19 @@ describe('Travel Component vnTravelExtraCommunity', () => {
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('save()', () => {
|
||||||
|
it('should make an HTTP query', () => {
|
||||||
|
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||||
|
|
||||||
|
const travelId = 1;
|
||||||
|
const data = {ref: 'New reference'};
|
||||||
|
const expectedData = {ref: 'New reference'};
|
||||||
|
$httpBackend.expect('PATCH', `Travels/${travelId}`, expectedData).respond(200);
|
||||||
|
controller.save(travelId, data);
|
||||||
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue