| import { PersonType } from '@shared/models'; |
| import { PersonTypesListComponent } from '@pages/admin/person-types/person-types-list/person-types-list.component'; |
| |
| describe('PersonTypesListComponent', () => { |
| let component: PersonTypesListComponent; |
| const sandbox: any = { |
| setDisplayForm: () => {}, |
| loadPersonType: () => {}, |
| deletePersonType: () => {}, |
| }; |
| |
| beforeEach(() => { |
| component = new PersonTypesListComponent(sandbox); |
| }); |
| |
| it('should create', () => { |
| expect(component).toBeTruthy(); |
| }); |
| |
| it('should initialize gridOptions context', () => { |
| component.ngOnInit(); |
| expect(component.gridOptions.context.icons.edit).toBeTruthy(); |
| expect(component.gridOptions.context.icons.delete).toBeTruthy(); |
| }); |
| |
| it('should call appropriate functions for edit event', () => { |
| const spy1: any = spyOn(sandbox, 'setDisplayForm'); |
| const spy2: any = spyOn(sandbox, 'loadPersonType'); |
| component.ngOnInit(); |
| component.gridOptions.context.eventSubject.next({type: "edit", data: new PersonType()}); |
| expect(spy1).toHaveBeenCalled(); |
| expect(spy2).toHaveBeenCalled(); |
| }); |
| |
| it('should call appropriate functions for delete event', () => { |
| const spy3: any = spyOn(sandbox, 'deletePersonType'); |
| component.ngOnInit(); |
| component.gridOptions.context.eventSubject.next({type: "delete", data: new PersonType()}); |
| expect(spy3).toHaveBeenCalled(); |
| }); |
| |
| }); |