import {TestBed} from '@angular/core/testing'; import {GameService} from './game.service'; import {GameActionsService} from './game-actions.service'; import {MicroLessonInfoOx} from 'ox-core'; describe('GameService', () => { let gameActions: GameActionsService; let gameService: GameService; const info = new MicroLessonInfoOx([], 1, 2, '', [], undefined); beforeEach(() => { TestBed.configureTestingModule({providers: [GameService, GameActionsService]}); gameService = TestBed.get(GameService); gameActions = TestBed.get(GameActionsService); gameService['beforeStartGame'] = () => { }; }); it('should be created', () => { const service: GameService = TestBed.get(GameService); expect(service).toBeTruthy(); }); it('After start game event should call start game, before start game, and set the microlesson id', () => { spyOn(gameService, 'startGame'); gameActions.startGame.emit({info: info, level: 1}); expect(gameService.startGame).toHaveBeenCalled(); expect(gameService.currentMicroLessonId).toBe(''); }); });