fix: fix some tests

This commit is contained in:
2025-02-02 00:45:46 +08:00
parent 28da493462
commit 6a03a2bd62
93 changed files with 2671 additions and 1622 deletions

View File

@@ -1,5 +1,5 @@
import { TestBed } from '@/testing';
import { lastValueFrom, of, throwError } from 'rxjs';
import { firstValueFrom, of, throwError } from 'rxjs';
import { vi } from 'vitest';
import type { CallbackContext } from '../flows/callback-context';
import { FlowsService } from '../flows/flows.service';
@@ -16,6 +16,7 @@ describe('RefreshSessionRefreshTokenService', () => {
let flowsService: FlowsService;
beforeEach(() => {
vi.useFakeTimers();
TestBed.configureTestingModule({
imports: [],
providers: [
@@ -34,6 +35,11 @@ describe('RefreshSessionRefreshTokenService', () => {
resetAuthDataService = TestBed.inject(ResetAuthDataService);
});
// biome-ignore lint/correctness/noUndeclaredVariables: <explanation>
afterEach(() => {
vi.useRealTimers();
});
it('should create', () => {
expect(refreshSessionRefreshTokenService).toBeTruthy();
});
@@ -44,7 +50,7 @@ describe('RefreshSessionRefreshTokenService', () => {
.spyOn(flowsService, 'processRefreshToken')
.mockReturnValue(of({} as CallbackContext));
await lastValueFrom(
await firstValueFrom(
refreshSessionRefreshTokenService.refreshSessionWithRefreshTokens(
{ configId: 'configId1' },
[{ configId: 'configId1' }]
@@ -63,7 +69,7 @@ describe('RefreshSessionRefreshTokenService', () => {
);
try {
await lastValueFrom(
await firstValueFrom(
refreshSessionRefreshTokenService.refreshSessionWithRefreshTokens(
{ configId: 'configId1' },
[{ configId: 'configId1' }]
@@ -85,7 +91,7 @@ describe('RefreshSessionRefreshTokenService', () => {
);
try {
await lastValueFrom(
await firstValueFrom(
refreshSessionRefreshTokenService.refreshSessionWithRefreshTokens(
{ configId: 'configId1' },
[{ configId: 'configId1' }]