1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| import {TestBed, inject} from '@angular/core/testing'; import {EvaluationsListComponent} from './evaluations-list.component'; import {Evaluation} from '../../evaluation/model/evaluation'; describe('EvaluationsListComponent', () => { beforeEach(() => TestBed.configureTestingModule({ providers: [ EvaluationsListComponent ] }));
it('should be initiale correctly', inject([EvaluationsListComponent], (component: EvaluationsListComponent) => { expect(component.evaluations.length).toBe(0); expect(component.selectedEvaluation).toBeUndefined(); }));
describe('hasEvaluations method', () => { it('should return false by default', inject([EvaluationsListComponent], (component: EvaluationsListComponent) => { expect(component.hasEvaluations()).toBeFalsy(); }));
it('should return true when evaluations is not empty', inject([EvaluationsListComponent], (component: EvaluationsListComponent) => { component.evaluations = [new Evaluation({id: 'ev1'})]; expect(component.hasEvaluations()).toBeTruthy(); })); });
describe('isSelected method', () => { it('should return false id evaluation is not selected', inject([EvaluationsListComponent], (component: EvaluationsListComponent) => { expect(component.isSelected(new Evaluation({id: 'ev1'}))).toBeFalsy(); }));
it('should return true when evaluations is not empty', inject([EvaluationsListComponent], (component: EvaluationsListComponent) => { let evaluation = new Evaluation({id: 'ev1'}); component.selectedEvaluation = evaluation; expect(component.isSelected(evaluation)).toBeTruthy(); })); }); });
|