Skip to content

Commit 6f958d8

Browse files
authored
Merge pull request #2215 from damienbod/fix/test-silent-pass-pattern
test: convert validation specs to await firstValueFrom
2 parents c4908a2 + 0c49482 commit 6f958d8

3 files changed

Lines changed: 2956 additions & 2897 deletions

File tree

projects/angular-auth-oidc-client/src/lib/validation/jwt-window-crypto.service.spec.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { TestBed, waitForAsync } from '@angular/core/testing';
1+
import { TestBed } from '@angular/core/testing';
2+
import { firstValueFrom } from 'rxjs';
23
import { CryptoService } from '../utils/crypto/crypto.service';
34
import { JwtWindowCryptoService } from './jwt-window-crypto.service';
45

@@ -21,15 +22,13 @@ describe('JwtWindowCryptoService', () => {
2122
});
2223

2324
describe('generateCodeChallenge', () => {
24-
it('returns good result with correct codeVerifier', waitForAsync(() => {
25+
it('returns good result with correct codeVerifier', async () => {
2526
const outcome = 'R2TWD45Vtcf_kfAqjuE3LMSRF3JDE5fsFndnn6-a0nQ';
26-
const observable = service.generateCodeChallenge(
27-
'44445543344242132145455aaabbdc3b4'
27+
const value = await firstValueFrom(
28+
service.generateCodeChallenge('44445543344242132145455aaabbdc3b4')
2829
);
2930

30-
observable.subscribe((value) => {
31-
expect(value).toBe(outcome);
32-
});
33-
}));
31+
expect(value).toBe(outcome);
32+
});
3433
});
3534
});

0 commit comments

Comments
 (0)