Files
wgenerator/src/app/modules/songs/services/song-data.service.spec.ts
2026-03-09 21:50:49 +01:00

32 lines
857 B
TypeScript

import {TestBed} from '@angular/core/testing';
import {SongDataService} from './song-data.service';
import {firstValueFrom, of} from 'rxjs';
import {DbService} from '../../../services/db.service';
describe('SongDataService', () => {
const songs = [{title: 'title1'}];
const mockDbService = {
col$: () => of(songs),
};
beforeEach(
() =>
void TestBed.configureTestingModule({
providers: [{provide: DbService, useValue: mockDbService}],
})
);
it('should be created', () => {
const service: SongDataService = TestBed.inject(SongDataService);
void expect(service).toBeTruthy();
});
it('should list songs', async () => {
const service: SongDataService = TestBed.inject(SongDataService);
const list = await firstValueFrom(service.list$);
void expect(list[0].title).toEqual('title1');
});
});