front unit test fixed

This commit is contained in:
Daniel Herrero 2018-03-07 13:42:15 +01:00
parent 42976aac71
commit 43bfbf3f4b
1 changed files with 0 additions and 50 deletions

View File

@ -23,56 +23,6 @@ describe('Client', () => {
expect(controller.address.id).toEqual(1);
});
describe('_setIconAdd()', () => {
it('should set the propertie sowAddIcon from all observations to false less last one that be true', () => {
controller.observations = [
{id: 1, description: 'Spiderman rocks', showAddIcon: true},
{id: 2, description: 'Batman sucks', showAddIcon: true},
{id: 3, description: 'Ironman rules', showAddIcon: false}
];
controller._setIconAdd();
expect(controller.observations[0].showAddIcon).toBeFalsy();
expect(controller.observations[1].showAddIcon).toBeFalsy();
expect(controller.observations[2].showAddIcon).toBeTruthy();
});
});
describe('addObservation()', () => {
it('should add one empty observation into controller observations collection and call _setIconAdd()', () => {
controller.observations = [];
spyOn(controller, '_setIconAdd').and.callThrough();
controller.addObservation();
expect(controller._setIconAdd).toHaveBeenCalledWith();
expect(controller.observations.length).toEqual(1);
expect(controller.observations[0].id).toBe(undefined);
expect(controller.observations[0].showAddIcon).toBeTruthy();
});
});
describe('removeObservation(index)', () => {
it('should remove an observation that occupies the position in the index given and call _setIconAdd()', () => {
let index = 2;
controller.observations = [
{id: 1, description: 'Spiderman rocks', showAddIcon: false},
{id: 2, description: 'Batman sucks', showAddIcon: false},
{id: 3, description: 'Ironman rules', showAddIcon: true}
];
spyOn(controller, '_setIconAdd').and.callThrough();
controller.removeObservation(index);
expect(controller._setIconAdd).toHaveBeenCalledWith();
expect(controller.observations.length).toEqual(2);
expect(controller.observations[0].showAddIcon).toBeFalsy();
expect(controller.observations[1].showAddIcon).toBeTruthy();
expect(controller.observations[index]).toBe(undefined);
});
});
describe('_observationsEquals', () => {
it('should return true if two observations are equals independent of control attributes', () => {
let ob1 = {id: 1, observationTypeFk: 1, description: 'Spiderman rocks', showAddIcon: true};