Created
April 30, 2020 18:27
-
-
Save ShaneRich5/f313b63f98af1e1b3c0cf83f9393f706 to your computer and use it in GitHub Desktop.
angular test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { fakeAsync, tick } from '@angular/core/testing'; | |
describe('brainstorming test', () => { | |
test('ngOnInit() should initiate autocomplete and its dataset', fakeAsync(() => { | |
// const mockedTemplateOptions = jest.fn() as any as FormlyTemplateOptions; | |
// component.to = mockedTemplateOptions; | |
// const mockedTemplateOptions = jest.spyOn(component.to, 'search').mockReturnValue('a'); | |
component.ngOnInit(); | |
component.searchDelay = 0; | |
component.dataset.subscribe( | |
(val: string) => { | |
expect(val).toBe('aaa'); | |
// expect(mockedSearch).toBeCalled(); | |
} | |
) | |
component.searchTerm.next('a') | |
component.searchTerm.next('a') | |
component.searchTerm.next('a') | |
tick(); | |
expect(component.isLoading).toBe(false); | |
}) | |
); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment