How to use the @angular/core/testing.TestBed.get function in @angular/core

To help you get started, we’ve selected a few @angular/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Arnaud73 / ngx-matomo / projects / ngx-matomo / src / lib / matomo-tracker.service.spec.ts View on Github external
it('should be created', () => {
    const service: MatomoTracker = TestBed.get(MatomoTracker);
    expect(service).toBeTruthy();
  });
});
github GNS3 / gns3-web-ui / src / app / components / drawings-listeners / interface-label-dragged / interface-label-dragged.component.spec.ts View on Github external
let link: Link = {} as Link;
    link.nodes = [
      {
        node_id: '1',
        adapter_number: 0,
        port_number: 0,
        label: {} as Label
      },
      {
        node_id: '2',
        adapter_number: 0,
        port_number: 0,
        label: {} as Label
      }
    ];
    mockedLinksDataSource = TestBed.get(LinksDataSource);

    spyOn(mockedLinksDataSource, 'get').and.returnValue(link);
    spyOn(mockedLinkService, 'updateNodes').and.returnValue(Observable.of({}));

    mockedLinksEventSource.interfaceDragged.emit(interfaceLabelDraggedDataEvent);

    expect(mockedLinkService.updateNodes).toHaveBeenCalled();
  });
});
github pazznetwork / ngx-chat / projects / pazznetwork / ngx-chat / src / lib / services / adapters / xmpp / plugins / roster.plugin.spec.ts View on Github external
TestBed.configureTestingModule({
            providers: [
                XmppChatConnectionService,
                {provide: XmppClientFactoryService, useValue: mockClientFactory},
                XmppChatAdapter,
                {provide: LogService, useValue: testLogService()},
                ContactFactoryService
            ]
        });

        chatConnectionService = TestBed.get(XmppChatConnectionService);
        chatConnectionService.client = xmppClientMock;
        contactFactory = TestBed.get(ContactFactoryService);
        chatAdapter = TestBed.get(XmppChatAdapter);
        logService = TestBed.get(LogService);
        chatAdapter.addPlugins([new RosterPlugin(chatAdapter, logService)]);

        chatConnectionService.userJid = parseJid('me', 'example.com', 'something');
    });
github fastlane / ci / web / app / build / build.component.spec.ts View on Github external
{provide: DataService, useValue: dataService}, {
              provide: ActivatedRoute,
              useValue: {
                paramMap: Observable.of(
                    convertToParamMap({projectId: '123', buildId: '3'}))
              }
            }
          ]
        })
        .compileComponents();

    fixture = TestBed.createComponent(BuildComponent);
    fixtureEl = fixture.debugElement;
    component = fixture.componentInstance;

    location = TestBed.get(Location);
  });
github Taskana / taskana / web / src / app / services / workbasket / workbasket.service.spec.ts View on Github external
beforeEach(() => {
		TestBed.configureTestingModule({
			imports: [HttpClientModule, HttpClientTestingModule, RouterTestingModule.withRoutes(routes)],
			providers: [
				WorkbasketService,
				HttpClient,
				HttpTestingController,
				DomainService,
				RequestInProgressService],
			declarations: [DummyDetailComponent]
		});

		httpClient = TestBed.get(HttpClient);
		workbasketService = TestBed.get(WorkbasketService);
		domainService = TestBed.get(DomainService);

	});
github ngrx / platform / projects / example-app / src / app / books / effects / collection.effects.spec.ts View on Github external
},
        },
        {
          provide: LOCAL_STORAGE_TOKEN,
          useValue: {
            removeItem: jest.fn(),
            setItem: jest.fn(),
            getItem: jest.fn(_ => JSON.stringify([])),
          },
        },
        provideMockActions(() => actions$),
      ],
    });

    db = TestBed.get(BookStorageService);
    effects = TestBed.get(CollectionEffects);
    actions$ = TestBed.get(Actions);
  });
  describe('checkStorageSupport$', () => {
github kyma-project / console / lambda / src / app / service-binding-usages / service-binding-usages.service.spec.ts View on Github external
beforeEach(() => {
    TestBed.configureTestingModule({
      imports: [HttpClientTestingModule],
      providers: [ServiceBindingUsagesService],
    });

    serviceBindingUsagesService = TestBed.get(ServiceBindingUsagesService);
    httpClientMock = TestBed.get(HttpTestingController);
  });
github Sunbird-Ed / SunbirdEd-portal / src / app / client / src / app / modules / core / components / data-driven-filter / data-driven-filter.component.spec.ts View on Github external
beforeEach(() => {
    fixture = TestBed.createComponent(DataDrivenFilterComponent);
    component = fixture.componentInstance;
    frameworkService = TestBed.get(FrameworkService);
    formService = TestBed.get(FormService);
    cacheService = TestBed.get(CacheService);
    userService = TestBed.get(UserService);
    resourceService = TestBed.get(ResourceService);
    publicDataService = TestBed.get(PublicDataService);
    spyOn(publicDataService, 'get').and.callFake((options) => {
      if (options.url === 'channel/v1/read/' + mockHashTagId && makeChannelReadSuc) {
        return of({result: {channel: {defaultFramework: mockFrameworkInput}}});
      } else if (options.url === 'framework/v1/read/' + mockFrameworkInput && makeFrameworkReadSuc) {
        return of({result: {framework: {code: mockFrameworkInput, categories: mockFrameworkCategories}}});
      }
      return throwError({});
    });
    spyOn(publicDataService, 'post').and.callFake((options) => {
      if (makeFormReadSuc) {
        return of({result: {form: {data: {fields: mockFormFields}}}});
      }
      return throwError({});
    });
  });
github Texera / texera / core / new-gui / src / app / workspace / service / workflow-graph / model / workflow-action.service.spec.ts View on Github external
beforeEach(() => {
    TestBed.configureTestingModule({
      providers: [
        WorkflowActionService,
        JointUIService,
        UndoRedoService,
        { provide: OperatorMetadataService, useClass: StubOperatorMetadataService }
      ],
      imports: [UndoRedoService]
    });
    service = TestBed.get(WorkflowActionService);
    texeraGraph = (service as any).texeraGraph;
    jointGraph = (service as any).jointGraph;
  });