fix: fix observable
This commit is contained in:
@@ -320,9 +320,8 @@ describe('CheckSessionService', () => {
|
||||
serviceAsAny.lastIFrameRefresh = lastRefresh;
|
||||
serviceAsAny.iframeRefreshInterval = lastRefresh;
|
||||
|
||||
serviceAsAny.init().subscribe((result: any) => {
|
||||
expect(result).toBeUndefined();
|
||||
});
|
||||
const result = await lastValueFrom(serviceAsAny.init());
|
||||
expect(result).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -364,10 +363,9 @@ expect(result).toBe(false);
|
||||
const expectedResultsInOrder = [false, true];
|
||||
let counter = 0;
|
||||
|
||||
checkSessionService.checkSessionChanged$.subscribe((result) => {
|
||||
expect(result).toBe(expectedResultsInOrder[counter]);
|
||||
counter++;
|
||||
});
|
||||
const result = await lastValueFrom(checkSessionService.checkSessionChanged$);
|
||||
expect(result).toBe(expectedResultsInOrder[counter]);;
|
||||
counter++;
|
||||
|
||||
(checkSessionService as any).checkSessionChangedInternal$.next(true);
|
||||
});
|
||||
|
||||
@@ -41,17 +41,15 @@ describe('RefreshSessionIframeService ', () => {
|
||||
.mockReturnValue(of(null));
|
||||
const allConfigs = [{ configId: 'configId1' }];
|
||||
|
||||
refreshSessionIframeService
|
||||
.refreshSessionWithIframe(allConfigs[0]!, allConfigs)
|
||||
.subscribe(() => {
|
||||
expect(
|
||||
await lastValueFrom(refreshSessionIframeService
|
||||
.refreshSessionWithIframe(allConfigs[0]!, allConfigs));
|
||||
expect(
|
||||
sendAuthorizeRequestUsingSilentRenewSpy
|
||||
).toHaveBeenCalledExactlyOnceWith(
|
||||
'a-url',
|
||||
allConfigs[0]!,
|
||||
allConfigs
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -152,15 +152,13 @@ describe('SilentRenewService ', () => {
|
||||
const urlParts =
|
||||
'code=some-code&state=some-state&session_state=some-session-state';
|
||||
|
||||
silentRenewService
|
||||
.codeFlowCallbackSilentRenewIframe([url, urlParts], config, allConfigs)
|
||||
.subscribe(() => {
|
||||
expect(spy).toHaveBeenCalledExactlyOnceWith(
|
||||
await lastValueFrom(silentRenewService
|
||||
.codeFlowCallbackSilentRenewIframe([url, urlParts], config, allConfigs));
|
||||
expect(spy).toHaveBeenCalledExactlyOnceWith(
|
||||
expectedContext,
|
||||
config,
|
||||
allConfigs
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('throws error if url has error param and resets everything on error', async () => {
|
||||
@@ -308,13 +306,10 @@ describe('SilentRenewService ', () => {
|
||||
const eventData = { detail: 'detail?detail2' } as CustomEvent;
|
||||
const allConfigs = [{ configId: 'configId1' }];
|
||||
|
||||
silentRenewService.refreshSessionWithIFrameCompleted$.subscribe(
|
||||
(result) => {
|
||||
expect(result).toEqual({
|
||||
const result = await lastValueFrom(silentRenewService.refreshSessionWithIFrameCompleted$);
|
||||
expect(result).toEqual({
|
||||
refreshToken: 'callbackContext',
|
||||
} as CallbackContext);
|
||||
}
|
||||
);
|
||||
|
||||
silentRenewService.silentRenewEventHandler(
|
||||
eventData,
|
||||
@@ -357,11 +352,8 @@ describe('SilentRenewService ', () => {
|
||||
const eventData = { detail: 'detail?detail2' } as CustomEvent;
|
||||
const allConfigs = [{ configId: 'configId1' }];
|
||||
|
||||
silentRenewService.refreshSessionWithIFrameCompleted$.subscribe(
|
||||
(result) => {
|
||||
expect(result).toBeNull();
|
||||
}
|
||||
);
|
||||
const result = await lastValueFrom(silentRenewService.refreshSessionWithIFrameCompleted$);
|
||||
expect(result).toBeNull();
|
||||
|
||||
silentRenewService.silentRenewEventHandler(
|
||||
eventData,
|
||||
|
||||
Reference in New Issue
Block a user