Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { MovieShowingsComponent } from './movie-showings.component';
- import { cold, getTestScheduler } from 'jasmine-marbles';
- describe('MovieShowingsComponent', () => {
- it('should not have a race condition', () => {
- const backend = jasmine.createSpyObj('backend', ['getShowings']);
- const cmp = new MovieShowingsComponent(backend);
- backend.getShowings.and.returnValue(cold('--x|', {x: ['10am']}));
- cmp.selectMovie('After the Storm');
- backend.getShowings.and.returnValue(cold('-y|', {y: ['11am']}));
- cmp.selectMovie('Paterson');
- // this will flush all observables
- getTestScheduler().flush();
- expect(cmp.movieTitle).toEqual('Paterson');
- expect(cmp.showings).toEqual(['11am']); // This will fail because showings is ['10am'].
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement