This file contains hidden or 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
| TestBed.configureTestingModule({ | |
| imports: [ | |
| HttpClientTestingModule, | |
| ], | |
| providers: [GameService, { provide: StatisticsService, useValue: statisticsServiceStub }] | |
| }); |
This file contains hidden or 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
| let http: HttpTestingController; | |
| let service: GameService; | |
| let statisticsService: StatisticsService; | |
| const statisticsServiceStub = { | |
| send: () => {} | |
| }; |
This file contains hidden or 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
| const expectedData = [ | |
| {id: '1', name: 'FirstGame', locale: 'ru', type: '2'}, | |
| {id: '2', name: 'SecondGame', locale: 'ru', type: '3'}, | |
| {id: '3', name: 'LastGame', locale: 'en', type: '1'}, | |
| ]; |
This file contains hidden or 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
| import { Injectable } from '@angular/core'; | |
| import { HttpClient } from '@angular/common/http'; | |
| import { Observable } from 'rxjs/Observable'; | |
| import { ReplaySubject } from 'rxjs/ReplaySubject'; | |
| import { Game } from '../models/gameModel'; | |
| import { StatisticsService } from './statistics.service'; | |
| @Injectable() | |
| export class GameService { |
This file contains hidden or 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
| it('should called open', () => { | |
| const openSpy = jest.spyOn(popup, 'open'); | |
| fixture.detectChanges(); | |
| expect(openSpy).toHaveBeenCalled(); | |
| }); |
This file contains hidden or 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
| popup = fixture.debugElement.injector.get(PopupService); |
This file contains hidden or 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
| popup = TestBed.get(PopupService); |
This file contains hidden or 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
| ngOnInit() { | |
| this.popup.open(SignInComponent); | |
| } |
This file contains hidden or 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
| providers: [{ provide: PopupService, useValue: popupServiceStub }] |
This file contains hidden or 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
| providers: [{ provide: PopupService, useClass: popupServiceStub }] |