global filter
This commit is contained in:
@@ -2,20 +2,22 @@ import {TestBed} from '@angular/core/testing';
|
||||
import {GuestShowDataService} from './guest-show-data.service';
|
||||
import {GuestShowService} from './guest-show.service';
|
||||
import {ShowService} from '../shows/services/show.service';
|
||||
import {Show} from '../shows/services/show';
|
||||
import {Song} from '../songs/services/song';
|
||||
|
||||
describe('GuestShowService', () => {
|
||||
let service: GuestShowService;
|
||||
let guestShowDataServiceSpy: jasmine.SpyObj<GuestShowDataService>;
|
||||
let showServiceSpy: jasmine.SpyObj<ShowService>;
|
||||
|
||||
beforeEach(() => {
|
||||
beforeEach(async () => {
|
||||
guestShowDataServiceSpy = jasmine.createSpyObj<GuestShowDataService>('GuestShowDataService', ['add', 'update$']);
|
||||
showServiceSpy = jasmine.createSpyObj<ShowService>('ShowService', ['update$']);
|
||||
guestShowDataServiceSpy.add.and.resolveTo('share-1');
|
||||
guestShowDataServiceSpy.update$.and.resolveTo();
|
||||
showServiceSpy.update$.and.resolveTo();
|
||||
|
||||
void TestBed.configureTestingModule({
|
||||
await TestBed.configureTestingModule({
|
||||
providers: [
|
||||
{provide: GuestShowDataService, useValue: guestShowDataServiceSpy},
|
||||
{provide: ShowService, useValue: showServiceSpy},
|
||||
@@ -30,8 +32,8 @@ describe('GuestShowService', () => {
|
||||
});
|
||||
|
||||
it('should create a new guest share, persist the generated shareId on the show and return the share url', async () => {
|
||||
const show = {id: 'show-1', showType: 'service-worship', date: new Date(), shareId: ''} as any;
|
||||
const songs = [{id: 'song-1'}] as any;
|
||||
const show = {id: 'show-1', showType: 'service-worship', date: new Date(), shareId: ''} as unknown as Show;
|
||||
const songs = [{id: 'song-1'}] as unknown as Song[];
|
||||
const expectedUrl = window.location.protocol + '//' + window.location.host + '/guest/share-1';
|
||||
|
||||
await expectAsync(service.share(show, songs)).toBeResolvedTo(expectedUrl);
|
||||
@@ -45,8 +47,8 @@ describe('GuestShowService', () => {
|
||||
});
|
||||
|
||||
it('should update an existing share and reuse its id in the returned url', async () => {
|
||||
const show = {id: 'show-1', showType: 'service-worship', date: new Date(), shareId: 'share-9'} as any;
|
||||
const songs = [{id: 'song-1'}] as any;
|
||||
const show = {id: 'show-1', showType: 'service-worship', date: new Date(), shareId: 'share-9'} as unknown as Show;
|
||||
const songs = [{id: 'song-1'}] as unknown as Song[];
|
||||
const expectedUrl = window.location.protocol + '//' + window.location.host + '/guest/share-9';
|
||||
|
||||
await expectAsync(service.share(show, songs)).toBeResolvedTo(expectedUrl);
|
||||
|
||||
Reference in New Issue
Block a user