fix: add cli
This commit is contained in:
@@ -346,11 +346,9 @@ describe('CheckSessionService', () => {
|
||||
|
||||
describe('checkSessionChanged$', () => {
|
||||
it('emits when internal event is thrown', async () => {
|
||||
checkSessionService.checkSessionChanged$
|
||||
.pipe(skip(1))
|
||||
.subscribe((result) => {
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
const result = await lastValueFrom(checkSessionService.checkSessionChanged$
|
||||
.pipe(skip(1)));
|
||||
expect(result).toBe(true);
|
||||
|
||||
const serviceAsAny = checkSessionService as any;
|
||||
|
||||
@@ -358,9 +356,8 @@ describe('CheckSessionService', () => {
|
||||
});
|
||||
|
||||
it('emits false initially', async () => {
|
||||
checkSessionService.checkSessionChanged$.subscribe((result) => {
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
const result = await lastValueFrom(checkSessionService.checkSessionChanged$);
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
|
||||
it('emits false then true when emitted', async () => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { DOCUMENT } from '../dom';
|
||||
import { Injectable, NgZone, OnDestroy, inject } from 'injection-js';
|
||||
import { Injectable, NgZone, type OnDestroy, inject } from 'injection-js';
|
||||
import { BehaviorSubject, Observable, of } from 'rxjs';
|
||||
import { take } from 'rxjs/operators';
|
||||
import { OpenIdConfiguration } from '../config/openid-configuration';
|
||||
import type { OpenIdConfiguration } from '../config/openid-configuration';
|
||||
import { DOCUMENT } from '../dom';
|
||||
import { LoggerService } from '../logging/logger.service';
|
||||
import { EventTypes } from '../public-events/event-types';
|
||||
import { PublicEventsService } from '../public-events/public-events.service';
|
||||
@@ -74,7 +74,7 @@ export class CheckSessionService implements OnDestroy {
|
||||
}
|
||||
|
||||
start(configuration: OpenIdConfiguration): void {
|
||||
if (!!this.scheduledHeartBeatRunning) {
|
||||
if (this.scheduledHeartBeatRunning) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -141,13 +141,13 @@ export class CheckSessionService implements OnDestroy {
|
||||
return of();
|
||||
}
|
||||
|
||||
if (!contentWindow) {
|
||||
if (contentWindow) {
|
||||
contentWindow.location.replace(checkSessionIframe);
|
||||
} else {
|
||||
this.loggerService.logWarning(
|
||||
configuration,
|
||||
'CheckSession - init check session: IFrame contentWindow does not exist'
|
||||
);
|
||||
} else {
|
||||
contentWindow.location.replace(checkSessionIframe);
|
||||
}
|
||||
|
||||
return new Observable((observer) => {
|
||||
@@ -197,7 +197,7 @@ export class CheckSessionService implements OnDestroy {
|
||||
|
||||
this.outstandingMessages++;
|
||||
contentWindow.postMessage(
|
||||
clientId + ' ' + sessionState,
|
||||
`${clientId} ${sessionState}`,
|
||||
iframeOrigin
|
||||
);
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { TestBed } from '@/testing';
|
||||
import { of } from 'rxjs';
|
||||
import { lastValueFrom, of } from 'rxjs';
|
||||
import { vi } from 'vitest';
|
||||
import { LoggerService } from '../logging/logger.service';
|
||||
import { mockProvider } from '../testing/mock';
|
||||
@@ -20,9 +20,6 @@ describe('RefreshSessionIframeService ', () => {
|
||||
mockProvider(UrlService),
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
refreshSessionIframeService = TestBed.inject(RefreshSessionIframeService);
|
||||
urlService = TestBed.inject(UrlService);
|
||||
});
|
||||
@@ -62,7 +59,9 @@ describe('RefreshSessionIframeService ', () => {
|
||||
it('dispatches customevent to window object', async () => {
|
||||
const dispatchEventSpy = vi.spyOn(window, 'dispatchEvent');
|
||||
|
||||
(refreshSessionIframeService as any).initSilentRenewRequest();
|
||||
await lastValueFrom(
|
||||
(refreshSessionIframeService as any).initSilentRenewRequest()
|
||||
);
|
||||
|
||||
expect(dispatchEventSpy).toHaveBeenCalledExactlyOnceWith(
|
||||
new CustomEvent('oidc-silent-renew-init', {
|
||||
|
||||
Reference in New Issue
Block a user