workarounds for jasmine.ajax in unit tests

This commit is contained in:
Denys Vuika
2024-09-13 14:30:55 -04:00
committed by Anton Ramanovich
parent 4d84f665ce
commit 880c670593
14 changed files with 81 additions and 24 deletions

View File

@@ -71,12 +71,23 @@ export class AdfHttpClient implements ee.Emitter, JsApiHttpClient {
ee(this);
}
/** @deprecated not used anywhere */
/**
* Update the default security options
*
* @param options security options
* @deprecated not used anywhere
*/
setDefaultSecurityOption(options: any) {
this.defaultSecurityOptions = this.merge(this.defaultSecurityOptions, options);
}
/** @deprecated not used anywhere */
/**
* Merge objects
*
* @param objects objects to merge
* @deprecated not used anywhere
* @returns merged object
*/
merge(...objects): any {
const result = {};
@@ -228,6 +239,7 @@ export class AdfHttpClient implements ee.Emitter, JsApiHttpClient {
)
.toPromise();
/* eslint-disable @typescript-eslint/space-before-function-paren */
(promise as any).abort = function () {
eventEmitter.emit('abort');
abort$.next();

View File

@@ -16,7 +16,7 @@
*/
import { HttpClient } from '@angular/common/http';
import { inject, Injectable } from '@angular/core';
import { Injectable } from '@angular/core';
import { ObjectUtils } from '../common/utils/object-utils';
import { Observable, ReplaySubject } from 'rxjs';
import { map, distinctUntilChanged, take } from 'rxjs/operators';
@@ -77,17 +77,14 @@ export class AppConfigService {
};
status: Status = Status.INIT;
protected onLoadSubject: ReplaySubject<any>;
onLoad: Observable<any>;
protected readonly onLoadSubject = new ReplaySubject<any>();
onLoad = this.onLoadSubject.asObservable();
get isLoaded() {
return this.status === Status.LOADED;
}
constructor() {
this.onLoadSubject = new ReplaySubject();
this.onLoad = this.onLoadSubject.asObservable();
this.extensionService.setup$.subscribe((config) => {
this.onExtensionsLoaded(config);
});

View File

@@ -15,15 +15,13 @@
* limitations under the License.
*/
import { Injectable } from '@angular/core';
import { inject, Injectable } from '@angular/core';
import { StorageService } from '../common/services/storage.service';
import { AppConfigService, AppConfigValues } from './app-config.service';
@Injectable()
export class DebugAppConfigService extends AppConfigService {
constructor(private storage: StorageService) {
super();
}
private storage = inject(StorageService);
get<T>(key: string, defaultValue?: T): T {
if (key === AppConfigValues.OAUTHCONFIG) {