All files / src/app/core/utils instance-creators.ts

60% Statements 3/5
0% Branches 0/2
0% Functions 0/1
60% Lines 3/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1633x 33x   33x                        
import { Injector } from '@angular/core';
import { OAuthService, OAuthStorage } from 'angular-oauth2-oidc';
 
export class InstanceCreators {
  static getOAuthServiceInstance(parent: Injector, storageFactory?: () => OAuthStorage): OAuthService {
    const injector = Injector.create({
      providers: [
        ...(storageFactory ? [{ provide: OAuthStorage, useFactory: storageFactory }] : []),
        { provide: OAuthService },
      ],
      parent,
    });
    return injector.get(OAuthService);
  }
}