Questions tagged [testbed]

A testbed is a platform for experimentation of large development projects. Testbeds allow for rigorous, transparent, and replicable testing of new technologies or code in an isolated environment.

157 questions
0
votes
0 answers

How to overwrite a library (ex., path) in Angular with the mocked library I have created for testing?

I am working on an Angular application that runs in Electron. However, we use cypress for E2E testing, and therefore I have mocked all the dependencies of Electron. So, we want the mocks to be used only when testing (to allow the app to be compiled…
0
votes
1 answer

How to test property values receiving Observable from service

I would like to ask what is the common practice of testing properties which receives data from services inline. I am not able to test my property which is being receiving values from service - defined inline. here is my property readonly…
PhobossFO
  • 17
  • 3
0
votes
0 answers

angular testbed : "Can't resolve all parameters for ..." despite providers

for all my components who have dependencies in their constructor, when I do the "compileComponents" I have an error : Error: Can't resolve all parameters for AsciiCharacterComponent: (?). I include those dependencies with providers: someMock =…
sab
  • 4,352
  • 7
  • 36
  • 60
0
votes
1 answer

All Angular dependencies need to be forwardRefs or Jest Breaks

I'm having a somewhat annoying problem with Jest and Angular. I have absolutely no idea why, but every single time I'm trying to inject even the simplest of service, it's causing jest to complain: FAIL apps/simplescrum/src/app/app.component.spec.ts …
Jim Drury
  • 79
  • 1
  • 4
0
votes
1 answer

Angular testing - Testing interdependent services

I am new to the testing world, so sorry if this question is too obvious! I have a fully functional and complex angular 9 project. I will explain my problem in simple terms here: I have multiple services: Service_MAIN (uses HttpClient, Router,…
Pranav Bhatia
  • 155
  • 4
  • 14
0
votes
2 answers

TestBed.OverrideProvider() doesn't work if TestBed.inject() or TestBed.get() (deprecated) has run before

Given the example spec test below beforeEach(function () { TestBed.configureTestingModule({ providers: [ { provide: TranslateService, useClass: TranslateServiceMock }, { provide: StoreService,…
Rambou
  • 968
  • 9
  • 22
0
votes
1 answer

NullInjectorError of feature store when testing component

I try to fix the test of LoginComponent. The error came when the feature store (notification) component was moved to a lazy-loaded module from SharedModule. I have no idea what can be wrong here. I tested many configurations of the testing component…
Xalion
  • 623
  • 9
  • 27
0
votes
2 answers

Unit testing a function with return value within subscribe

I have a function to be unit tested that I'm not sure how to approach. Simplified: someFunction(): boolean { this.service.login().subscribe(response => { if (response) { return someOtherFunction(); } }); } someOtherFunction(): boolean { …
Century
  • 283
  • 1
  • 4
  • 22
0
votes
2 answers

Angular How to update mock data in different unit tests

describe('landing component', () => { beforeEach(() => { mockAccountService = new Mock({ getSelectedContractAccountNumber: () => { return testAccountNumber; …
Franva
  • 6,565
  • 23
  • 79
  • 144
0
votes
0 answers

Testing service with dependencies

I'm trying to set up a test for my service using TestBed. That service has some dependencies of other services. I've created .stub files for those dependencies and exported them. Problem is when I try to use these stubs in the test it still seems…
odke
  • 59
  • 1
  • 1
  • 3
0
votes
1 answer

How to mock a Router object and inject into providers array in TestBed configuration

I'm trying to create and inject a mocked router object into TestBed configuration but it does not work. Below is the configuration : let mockQuote: QuoteService = new QuoteService(null, null); let mockOshcStore: OshcStore = new OshcStore(null); let…
Juliyanage Silva
  • 2,529
  • 1
  • 21
  • 33
0
votes
1 answer

Angular unit tests for services that uses TranslateService

How do I have to use the TranslateService in unit tests of a service? TranslateService is used in the service class in that way: export class ErrorControllerService { constructor(public translate: TranslateService) { } ... } And I tried…
Andreas
  • 25
  • 1
  • 3
0
votes
1 answer

Spy return value is not work correctly in Service test using jasmine

I'm not able to correctly mock my return value of a function inside my injected service in my Angular test. I'm using: jasmine v2.8.0 and jasmine-core v2.8.0 I simplified the code to make it easier to understand. Here it is... This is my Service…
Balázs Fodor-Pap
  • 438
  • 1
  • 5
  • 16
0
votes
1 answer

Angular testbed - testing async observable that is passed via input from parent component

I have simple child component: import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core'; import { HistorySession } from './models'; import { Observable } from 'rxjs'; @Component({ selector: 'app-history-info', templateUrl:…
sensei
  • 7,044
  • 10
  • 57
  • 125
0
votes
1 answer

Delay/Latency calculation for Zolertia Re-motes

I intend to calculate the latency of packets sent by multiple (24) sensor nodes to a single sink using CSMA/CA MAC in Contiki-ng. Apparently, there is no synchronization mechanism available for the zoul platform. The TSCH has a mechanism for…
rmateeq
  • 1
  • 1