vitest implementation
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {of} from 'rxjs';
|
||||
import {firstValueFrom, of} from 'rxjs';
|
||||
import {SongService} from './song.service';
|
||||
import {SongListResolver} from './song-list.resolver';
|
||||
|
||||
@@ -22,11 +22,8 @@ describe('SongListResolver', () => {
|
||||
expect(resolver).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should resolve the first emitted song list from the service', done => {
|
||||
resolver.resolve().subscribe(songs => {
|
||||
expect(songServiceSpy.listLoaded$).toHaveBeenCalled();
|
||||
expect(songs).toEqual([{id: 'song-1', title: 'Amazing Grace'}] as never);
|
||||
done();
|
||||
});
|
||||
it('should resolve the first emitted song list from the service', async () => {
|
||||
await expectAsync(firstValueFrom(resolver.resolve())).toBeResolvedTo([{id: 'song-1', title: 'Amazing Grace'}] as never);
|
||||
expect(songServiceSpy.listLoaded$).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {of} from 'rxjs';
|
||||
import {firstValueFrom, of} from 'rxjs';
|
||||
import {SongDataService} from './song-data.service';
|
||||
import {SongService} from './song.service';
|
||||
import {UserService} from '../../../services/user/user.service';
|
||||
@@ -41,11 +41,8 @@ describe('SongService', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should list songs from the data service', done => {
|
||||
service.list$().subscribe(songs => {
|
||||
expect(songs).toEqual([song]);
|
||||
done();
|
||||
});
|
||||
it('should list songs from the data service', async () => {
|
||||
await expectAsync(firstValueFrom(service.list$())).toBeResolvedTo([song]);
|
||||
});
|
||||
|
||||
it('should delegate reads to the data service', async () => {
|
||||
|
||||
@@ -38,7 +38,7 @@ Bridge
|
||||
Cool bridge without any chords
|
||||
`;
|
||||
|
||||
beforeEach(() => void TestBed.configureTestingModule({}));
|
||||
beforeEach(async () => await TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: TextRenderingService = TestBed.inject(TextRenderingService);
|
||||
@@ -478,13 +478,13 @@ Text`;
|
||||
const service: TextRenderingService = TestBed.inject(TextRenderingService);
|
||||
const text = 'Strophe\nC\tG\ta\nText';
|
||||
|
||||
void expect(service.validateChordNotation(text)).toContain(
|
||||
void expect(service.validateChordNotation(text)).toEqual(expect.arrayContaining([
|
||||
jasmine.objectContaining({
|
||||
lineNumber: 2,
|
||||
token: '\t',
|
||||
reason: 'tab_character',
|
||||
})
|
||||
);
|
||||
}),
|
||||
]));
|
||||
});
|
||||
|
||||
it('should not flag tabs on non chord lines', () => {
|
||||
|
||||
@@ -7,8 +7,8 @@ import {Line} from './line';
|
||||
describe('TransposeService', () => {
|
||||
let service: TransposeService;
|
||||
|
||||
beforeEach(() => {
|
||||
void TestBed.configureTestingModule({});
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(TransposeService);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user