jasmine Questions

2

Solved

I am doing angular unit testing. Does TestBed.inject(service) create a new instance of the service? I was always under the assumption that TestBed.configureTestingModule() created the service and b...
Enenstein asked 3/6, 2021 at 4:40

2

Solved

I am new to Jasmine with Angular 2, I am frequently working with the TestBed object when writting a Testcase and getting the error:Please call "TestBed.compileComponents" before your test. How do...
Harrietteharrigan asked 6/10, 2016 at 6:10

4

Solved

My code includes an if block like this Service: import { isDevMode } from '@angular/core'; export class MyService { constructor() {} methodToTest(): { if (!isDevMode()) { doSomething(); } ...
Halfcock asked 17/7, 2018 at 21:37

4

Solved

I have a component A that use a component B,c,D in its template: ###template-compA.html <comp-b></comp-b> <comp-c [myinput]="obj.myinput"></comp-c> <comp-d ></...
Bes asked 22/3, 2017 at 11:35

6

Solved

I have an angular 8, that uses karma/jasmine to run some unit tests. I can run tests by executing the following command ng test but I'm getting the following error: ERROR in ./src/polyfills.ts M...
Morita asked 12/7, 2019 at 9:0

4

Solved

I have the below http interceptor in my angular application and I would like to unit test the same using Jasmine. I googled some of them and tried but its not working as expected. Please find the b...
Distant asked 8/9, 2021 at 9:51

2

I'm trying to write a basic test for an Angular 2 web app which is attempting to check if my submit() function is being called when the submit button is clicked. When I do this it works fine both ...
Gorgias asked 3/10, 2016 at 18:22

7

The problem Hi everybody! First time asking question here, hoping for some help. I'm currently developing a Electron+Angular application and I'm finally preparing for testing all the services and c...
Brawn asked 15/7, 2020 at 12:39

3

Solved

I'm working through the text: Professional JavaScript for Web Developers by Nicholas Zakas and I'm testing the examples with Jasmine.js. I can currently test the output of a function by specifying...
Piccolo asked 6/11, 2013 at 23:25

2

Let's say I have this function I want to test: var test = function () { console.log('words!'); }; I'd write something like this define('test()', function () { it('prints "words!" to the scree...
Intarsia asked 13/3, 2017 at 17:40

6

Solved

I m new to angular 4 and trying to test one of the angular 4 feature router.paramMap from unit tests, Reading route params in fallowing way and working as expected in my application. constructor(p...
Monosymmetric asked 19/10, 2017 at 5:11

3

Let's say I have an Angular Component which defines an Observable myObs$ as one of its properties. In one test, given certain conditions, I want to test that myObs$ does not notify. In the logic t...
Garrott asked 30/1, 2019 at 18:15

9

Solved

I have a component which is meant to be used in an Angular Material MdDialog : @Component({ ... }) export class MyComponent { constructor(@Inject(MAT_DIALOG_DATA) public data: any, public dialog...

3

Solved

Currently in a project Ive been assigned to there is an issue with VSCode not being able to determine the properties for the Jasmine assertions. The tests run successfully, but intellisense in VSCo...
Military asked 16/12, 2022 at 16:58

5

I'm trying to create a spy object for my tests: let spy: jasmine.SpyObj<GeneralService>; Unfortunately, I'm getting this error when running ng test: Namespace 'jasmine' has no exported me...
Nuss asked 17/9, 2018 at 8:34

17

Solved

I have Angular2 project build with Angular-CLI (beta 20). Is there a way to run tests against only one selected spec file? I used to have a project based on Angular2 quick start, and I could man...
Hickox asked 18/11, 2016 at 18:20

9

Solved

For some reason I can't understand, Karma says that Jasmine can't find any of my test specs. I'm using Angular 9, Typescript and ng test to run the tests. I also ran jasmine init to create the jasm...
Septuagenarian asked 6/12, 2019 at 12:40

2

Solved

I've got a loop creating several matCard elements. These represent events. Some of them are in the past. I give these a class to grey them out, and add a matTooltip to explain what that means. <...
Mazurek asked 28/3, 2021 at 20:29

2

I want to unit test some ES6 classes that are stored as modules. However, when I try to run my tests, import triggers an error message: Cannot use import statement outside a module which means I ca...
Ummersen asked 24/5, 2020 at 12:17

2

Solved

On the angular documentation I see these two functions, tick() and flush(). Both of these seem to do similar things. From the angular documentation, it says for tick: Simulates the asynchronous ...
Janae asked 7/6, 2019 at 17:23

6

Solved

Hi have some error with testing my App made with Angular 7. I do not have much experience in angular, so I would need your help+ Error: StaticInjectorError(DynamicTestModule)[BeerDetailsComponent ...
Alver asked 6/12, 2018 at 15:10

6

Solved

Im writing a code with in angular with ChangeDetectorRef The function itself is working fine. getVersionInfos() { concat( of( this.getApiSubs = this.aboutInfoService.getApiVersion().subscribe((da...
Executor asked 14/1, 2021 at 1:21

0

For some time, I've been banging my head with running a pretty straightforward (close to a freshly bootstrapped Aurelia project) configuration. I have a problem launching any tests, and the Chrome ...
Lycanthropy asked 8/3 at 12:22

4

Solved

Angular 4 unit test for a subscribe. I want to test that my subscribe returns an array of Users. I want to mock a list of users and test a function called getUsers. The subscribe unit test doesnt...
Ysabel asked 23/8, 2017 at 12:38

4

Solved

I never used Jasmine before but I'm required for this little project that I'm working on. Can't quite figure it out, any help would be appreciated. I have looked at various tutorials and googeled t...
Unaccomplished asked 27/4, 2017 at 12:47

© 2022 - 2024 — McMap. All rights reserved.