testbed Questions

4

Solved

I am upgrading from Angular 8.0 to Angular 9.1.1. With a little bit of work, everything builds and runs fine. I ran into the localization issue https://angular.io/guide/migration-localize and fol...
Comestible asked 14/4, 2020 at 16:26

4

First example I have got the following test: import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { Component } from '@angular/core'; @Component({ template: '<ul...
Lolly asked 16/3, 2019 at 10:28

4

I want to import certain modules for all testing suits such as ngrx Store, ngx translate or httpClientModule in an [email protected] project with angular 5. in the generated test.ts I have ad...
Callow asked 9/11, 2017 at 14:30

3

Solved

I have MainComponent that uses ChildComponentA as a @ViewChild. MainComponent is calling a method on ChildComponentA. I want to write an unit test case mocking ChildComponentA. How can I do this u...
Heal asked 1/9, 2016 at 22:33

7

Solved

I have just started with Unit-Testing, and I have been able to mock my own services and some of Angular and Ionic as well, but no matter what I do ChangeDetectorRef stays the same. I mean which ki...
Rebato asked 2/1, 2017 at 5:34

5

Solved

I have referred the following link to get the answers, but I couldn't find any working solution for my scenario. Error: (SystemJS) Can't resolve all parameters for ActivatedRoute: (?, ?, ?, ?,...
Coating asked 3/1, 2018 at 12:46

2

Solved

I used ResizeObserver in my component and its works fine. But get such error when running ut: ReferenceError: ResizeObserver is not defined 133 | }); 134 | > 135 | this.resizeObserver = ne...
Antecedence asked 6/1, 2021 at 7:22

2

Solved

I'm working on unit testing under my Angular app. My version of Angular is 4.0.0. My component look like this: component.ts: import { GdfaClientService } from '../../../service/gdfa-client.ser...
Asshur asked 6/11, 2017 at 15:39

2

Solved

I use ng2-translate in my Angular 5 project and I am trying to create a unit test for one component. I always import TranslateModule.forRoot( *...* ) in my Tests and the tests will work using the t...

6

In one of my unit test files, I have to mock several times the same service with different mocks. import { MyService } from '../services/myservice.service'; import { MockMyService1 } from '../mock...
Hyetal asked 15/2, 2018 at 15:45

3

Solved

I am using angular 5.2.0. I have a child component import { Component } from '@angular/core'; @Component({ template: `<div><div></div></div>`, }) export class ChildCompone...
Namnama asked 25/7, 2018 at 9:32

9

Solved

I have some unit tests using Angular TestBed. Even if the tests are very simple, they run extremely slow (on avarage 1 test assetion per second). Even after re-reading Angular documentation, I coul...
Conference asked 7/12, 2017 at 9:28

3

I am new to Angular 2 testing. I am trying to figure out what is the difference in using testsbed.get() and just using inject at the test level. eg: beforeEach(() => { TestBed.configureTestin...
Alonzoaloof asked 28/3, 2017 at 20:49

10

Solved

I'm looking for something like http://phpfiddle.org/, but completely local. I don't want to commit to installing something as complex as Apache, then PHP on top of that, just to try out code ...
Racehorse asked 1/2, 2014 at 8:11

1

I'm new to angular and jhipster, I've edited the login component and I've added the formbuilder and MatDialogRef and update the Unit test: import { FormBuilder, FormGroup, Validators } from '@angu...
Informative asked 5/2, 2020 at 15:22

1

Solved

I am migrating my component unit tests with only jest to UI tests using Testbed and jest (Before I had just unit test with component = new MyCompontent()). I am using Angular 11. There is one thing...
Daviddavida asked 10/1, 2021 at 10:9

3

Solved

I am trying to use Testbed in a new Angular 7 / Ionic 4 app but cannot run any tests because my components depend on an Ionic native plugin, storage. app.component.spec.ts import { CUSTOM_ELEMENT...
Naman asked 23/4, 2019 at 14:47

1

Solved

I need to test my service which is using Injector to inject services instead of constructor(). The main reason for which I use this way is the large number of services which extends my common Simp...
Unclinch asked 12/6, 2020 at 10:15

3

Solved

I'm setting up a NativeScript-Angular project, and would like to implement unit tests using Jasmine-Karma in order to test my components using css selectors. How can I setup a simple unit test (bey...
Fordo asked 24/7, 2019 at 15:54

2

I have a component like this: export class ParentComponent implements OnInit, OnDestroy { @ViewChild(ChildComponent) childComponent: ChildComponent; } which is using the childComponent to mak...
Linis asked 9/8, 2017 at 7:15

1

Solved

I am using Angular 6 and I have one concern regarding every test which I have seen so far. Here's a simple test of simple component which is generated by cli. describe('CompComponent', () => { ...
Underexpose asked 17/10, 2018 at 22:29

1

I tried to use Angular TestBed as described on angular.io website to test a simple component, but I get errors like: TypeError: undefined is not an object (evaluating 'ProxyZoneSpec.assertPresent')...
Queenqueena asked 28/8, 2017 at 11:57

1

I'm writing TestBed unit tests. There is a certain component, which is a child of the component-under-test. That child component causes errors while the test is running. That child component is no...
Lareine asked 10/11, 2017 at 14:4

2

Solved

I'm working on unit tests within my Angular app , i'm using TestBed approach , I'm testing components , so each spec file looks like this import... describe('AppComponent', () => { // Importin...
Rinee asked 30/10, 2017 at 14:25

2

Solved

When using the following configuration for a test fixture, I get complaints that the tag cannot be found. Substituting the MockSelectionToolComponent directly in AppModule works fine, so must be so...
Scutcheon asked 26/6, 2017 at 10:52

© 2022 - 2024 — McMap. All rights reserved.