beforeEach(() => {
     injector = ReflectiveInjector.resolveAndCreate([
         AlfrescoSettingsService,
         AlfrescoApiService,
         AlfrescoAuthenticationService,
         UploadService
     ]);
 });
Пример #2
0
export function serverBootstrap(
    appComponentType: Type,
    customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<any>> {
  reflector.reflectionCapabilities = new ReflectionCapabilities();
  let providers = [SERVER_APPLICATION_PROVIDERS, customProviders || []];
  var appInjector = ReflectiveInjector.resolveAndCreate(providers, serverPlatform().injector);
  return coreLoadAndBootstrap(appComponentType, appInjector);
}
Пример #3
0
 function makeLocation(
     baseHref: string = '/my/app', provider: any = /*@ts2dart_const*/[]): Location {
   locationStrategy = new MockLocationStrategy();
   locationStrategy.internalBaseHref = baseHref;
   let injector = ReflectiveInjector.resolveAndCreate(
       [Location, {provide: LocationStrategy, useValue: locationStrategy}, provider]);
   return location = injector.get(Location);
 }
Пример #4
0
export function GET_HTTP_PROVIDERS_INJECTOR(additionalProviders?: any[]): ReflectiveInjector {
  
  if (additionalProviders) {
    providers = providers.concat(additionalProviders);
  }  

  return ReflectiveInjector.resolveAndCreate(providers);  
}
Пример #5
0
 beforeEach(function() {
   const injector = ReflectiveInjector.resolveAndCreate([
     MATCH_ROUTE_PROVIDERS,
     RESOURCE_LOADER_PROVIDERS,
     provide(ROUTES, { useValue: routes })
   ]);
   traverser = injector.get(RouteTraverser);
 });
Пример #6
0
export function bootstrapApp(
    appComponentType: Type,
    customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<any>> {
  var appInjector = ReflectiveInjector.resolveAndCreate(
      [WORKER_APP_DYNAMIC_APPLICATION_PROVIDERS, isPresent(customProviders) ? customProviders : []],
      workerAppPlatform().injector);
  return coreLoadAndBootstrap(appInjector, appComponentType);
}
Пример #7
0
export function bootstrap(
    appComponentType: Type,
    customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<any>> {
  reflector.reflectionCapabilities = new ReflectionCapabilities();
  var appInjector = ReflectiveInjector.resolveAndCreate(
      [BROWSER_APP_PROVIDERS, isPresent(customProviders) ? customProviders : []],
      browserPlatform().injector);
  return coreLoadAndBootstrap(appInjector, appComponentType);
}
Пример #8
0
    beforeEach(() => {

      injector = ReflectiveInjector.resolveAndCreate([
        StoreModule.provideStore({ todos, todoCount }).providers
      ]);

      store = injector.get(Store);
      dispatcher = injector.get(Dispatcher);
    });
Пример #9
0
    /**
     * Gets Angular2Apollo service and calls a method
     *
     * Checks if method with the same name has been called
     * with the same same options
     *
     * It also checks if service method returns result of ApolloClient method
     *
     * @param  {string} method  Name of method you want to test
     * @param  {any} options    Used options
     * @param  {any} result     Mock result
     */
    function rawApiCall(method: string, options = 'options', result = 'result') {
      spyOn(client, method).and.returnValue(result);

      const injector = ReflectiveInjector.resolveAndCreate([defaultApolloClient(client), APOLLO_PROVIDERS]);
      const service = injector.get(Angular2Apollo);

      expect(service[method](options)).toBe(result);
      expect(client[method]).toHaveBeenCalledWith(options);
    }
Пример #10
0
    it('should work mockWrapper with fakeDI', () => {
        let injector = ReflectiveInjector.resolveAndCreate([
            MockWrapperService,
            provide(TestService, { useClass: MockTestService })]);

        let service = injector.get(MockWrapperService);
        expect(service.getService()).toContain({ fname: 'vasya', lname: 'pupkin' });

    });