Created
June 16, 2022 14:02
-
-
Save thecodinganalyst/5824f6c5d10b72d1c7367de4e0938c91 to your computer and use it in GitHub Desktop.
NgRx effects test
This file contains 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
describe('getBooks action', function () { | |
it("should call getBooks and redirect to booksLoaded action", (done) => { | |
spyOn(booksService, "getBooks").and.returnValue(of(books)) | |
actions$ = of(BookStoreActions.loadBooks); | |
effects.loadBooks$.subscribe(res => { | |
expect(booksService.getBooks).toHaveBeenCalled() | |
expect(res).toEqual(BookStoreActions.booksLoaded({books: books})) | |
done() | |
}) | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment