Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
todo-list.effects.spec.ts
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
You can’t perform that action at this time.