Skip to content

Instantly share code, notes, and snippets.

@thecodinganalyst
Created June 16, 2022 14:02
Show Gist options
  • Save thecodinganalyst/5824f6c5d10b72d1c7367de4e0938c91 to your computer and use it in GitHub Desktop.
Save thecodinganalyst/5824f6c5d10b72d1c7367de4e0938c91 to your computer and use it in GitHub Desktop.
NgRx effects test
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