Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function OcSDKConfig() {
const apiurl = 'https://api.ordercloud.io';
const apiVersion = 'v1';
const authUrl = 'https://auth.ordercloud.io/oauth/token';
return new Configuration({
basePath: `${apiurl}/${apiVersion}`,
authPath: authUrl,
cookiePrefix: ocAppConfig.appname.replace(/ /g, '_').toLowerCase(),
});
}
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule,
HttpClientTestingModule,
CookieModule.forRoot(),
],
providers: [
{ provide: Router, useValue: router },
{ provide: CookieService, useValue: cookieService },
OcAuthService,
AppAuthService,
{ provide: AppErrorHandler, useValue: appErrorHandler },
OcTokenService,
{ provide: Configuration, useValue: new Configuration() },
{ provide: applicationConfiguration, useValue: appConfig },
{ provide: AppStateService, useValue: appStateService },
],
});
appConfig = TestBed.get(applicationConfiguration);
tokenService = TestBed.get(OcTokenService);
appAuthService = TestBed.get(AppAuthService);
authService = TestBed.get(OcAuthService);
});
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule,
HttpClientTestingModule,
CookieModule.forRoot(),
],
providers: [
{ provide: Router, useValue: router },
{ provide: CookieService, useValue: cookieService },
OcAuthService,
AppAuthService,
{ provide: AppErrorHandler, useValue: appErrorHandler },
OcTokenService,
{ provide: Configuration, useValue: new Configuration() },
{ provide: applicationConfiguration, useValue: appConfig },
{ provide: AppStateService, useValue: appStateService },
{ provide: BaseResolveService, useValue: baseResolveService },
],
});
appConfig = TestBed.get(applicationConfiguration);
tokenService = TestBed.get(OcTokenService);
appAuthService = TestBed.get(AppAuthService);
authService = TestBed.get(OcAuthService);
});
beforeEach(async(() => {
const authService = { isUserAnon: jasmine.createSpy('isUserAnon') };
const appConfig = { appname: 'mgr-dev' };
TestBed.configureTestingModule({
imports: [RouterTestingModule, CookieModule.forRoot()],
providers: [
{ provide: OcAuthService, useValue: authService },
HttpClient,
HttpHandler,
{ provide: Configuration, useValue: new Configuration() },
{ provide: applicationConfiguration, useValue: appConfig },
],
});
service = TestBed.get(BaseResolveService);
}));