import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { SimplePaginationComponent } from './simple.pagination.component'; import { EventEmitter } from '@angular/core'; describe('SimplePaginationComponent', () => { let component: SimplePaginationComponent; let fixture: ComponentFixture; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [SimplePaginationComponent], imports: [], }).compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(SimplePaginationComponent); component = fixture.componentInstance; component.offset = 0; component.hasNextPage = true; component.paginationClicked = new EventEmitter(); fixture.detectChanges(); }); it('should call onPagination', () => { component.paginationClicked.emit = jest.fn(); component.onPagination({ type: 'next' }); expect(component.paginationClicked.emit).toHaveBeenCalled(); }); it('should call nullAndUndefinedCheck', () => { const result1 = component.nullAndUndefinedCheck(0); const result2 = component.nullAndUndefinedCheck(true); const result3 = component.nullAndUndefinedCheck(null); const result4 = component.nullAndUndefinedCheck(undefined); expect(result1).toBeTruthy(); expect(result2).toBeTruthy(); expect(result3).toBeFalsy(); expect(result4).toBeFalsy(); }); it('should create', () => { expect(component).toBeTruthy(); }); });