refactor: rewrite observable subscribe

This commit is contained in:
2025-01-30 21:38:04 +08:00
parent 7ff7e891fc
commit ca5f4984a4
9 changed files with 242 additions and 243 deletions

View File

@@ -363,7 +363,7 @@ describe('ParLoginService', () => {
vi.spyOn(checkAuthService, 'checkAuth').mockReturnValue(
of({} as LoginResponse)
);
vi.spyOnProperty(popupService, 'result$').mockReturnValue(
spyOnProperty(popupService, 'result$').mockReturnValue(
of({} as PopupResult)
);
const spy = vi.spyOn(popupService, 'openPopUp');
@@ -417,9 +417,7 @@ describe('ParLoginService', () => {
receivedUrl: 'someUrl',
};
vi.spyOnProperty(popupService, 'result$').mockReturnValue(
of(popupResult)
);
spyOnProperty(popupService, 'result$').mockReturnValue(of(popupResult));
service.loginWithPopUpPar(config, allConfigs).subscribe((result) => {
expect(checkAuthSpy).toHaveBeenCalledExactlyOnceWith(
@@ -465,9 +463,7 @@ describe('ParLoginService', () => {
const checkAuthSpy = vi.spyOn(checkAuthService, 'checkAuth');
const popupResult = { userClosed: true } as PopupResult;
vi.spyOnProperty(popupService, 'result$').mockReturnValue(
of(popupResult)
);
spyOnProperty(popupService, 'result$').mockReturnValue(of(popupResult));
service.loginWithPopUpPar(config, allConfigs).subscribe((result) => {
expect(checkAuthSpy).not.toHaveBeenCalled();