Last active
September 9, 2022 15:48
-
-
Save lydemann/97969c9319a9f4f8296eb0d63da82fe1 to your computer and use it in GitHub Desktop.
todo-list.effects.spec.ts
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('TodoListEffects', () => { | |
let actions: Observable<any>; | |
let effects: TodoListEffects; | |
beforeEach(() => { | |
TestBed.configureTestingModule({ | |
providers: [ | |
TodoListEffects, | |
provideMockActions(() => actions), | |
mockProvider(TodoListResourcesService), | |
], | |
}); | |
effects = TestBed.inject(TodoListEffects); | |
}); | |
it('should return a stream with todo list loaded action', () => { | |
const todoList: TODOItem[] = [{ title: '', id: '1', description: '' }]; | |
const action = new LoadTodoList(); | |
const outcome = new TodoItemsLoaded(todoList); | |
actions = hot('-a', { a: action }); | |
const response = cold('-a|', { a: todoList }); | |
todoListService.getTodos.and.returnValue(response); | |
const expected = cold('--b', { b: outcome }); | |
expect(effects.loadTodoList$).toBeObservable(expected); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@lydemann where does
mockProvider
come from?