jasmine Questions

5

Solved

I'm having difficulties with a unit test in which I want to verify the processing of a file, which would usually be selected in the view via <input type='file'>. In the controller part of my...
Humiliate asked 2/8, 2014 at 17:41

4

I'm using jasmine on an angular2 project and having some trouble writing a custom matcher for a test. I want to be able to compare two relatively complex objects. I found this article which claims ...
Blotto asked 22/3, 2017 at 15:32

4

Solved

After upgrading to babel 7.1.5 my tests fail when i'm using import * as. test.spec.js import * as Helper from "../../../../src/renderer/modules/Helper"; describe('Testing', () => { it('Shoul...
Helprin asked 14/11, 2018 at 9:27

6

I'm running karma test cases through gulp as below: gulp.task('unit-test-karma', function () { return gulp.src(filePaths.libraryPaths.concat(filePaths.codePathsVerbose.concat(filePaths.testPaths)...
Mayfield asked 26/12, 2015 at 6:36

13

is it possible to use Jasmine unit testing framework's spyon method upon a classes private methods? The documentation gives this example but can this be flexible for a private function? describe(&q...
Shopping asked 12/12, 2011 at 14:9

3

is any option for verbore output for testing by jest? I can see which modules are mocked. I tried jasmine.VERBOSE = true; but not working. Thanks for answer.
Etymology asked 24/5, 2015 at 20:25

5

Solved

When writing tests with JasmineJS I have many tests that have similar beforeEach/afterEach code. Is there a way to implement an inheritance model using JasmineJS test suites? I can group all test...
Bedard asked 26/6, 2013 at 10:40

17

Solved

I'm following this tutorial from angular.io As they said, I've created hero.spec.ts file to create unit tests: import { Hero } from './hero'; describe('Hero', () => { it('has name', () => { ...
Heinrik asked 18/8, 2016 at 13:51

6

I have checked a lot of articles and answers but I don't seem to find the right way to mock HTTP Requests for my methods. I want to test my frontend application independently from the backend. Here...
Scimitar asked 20/11, 2019 at 9:24

4

Solved

Getting error while trying to check for empty array. I tried using: Case 1: By initializing as an array expect(fixture.componentInstance.dataSource).toBe([]); Case 2: By initializing as an arra...
Montagu asked 3/10, 2017 at 11:31

8

Solved

In my app.component.ts I have the following ngOnInit function: ngOnInit() { this.sub = this.router.events.subscribe(e => { if (e instanceof NavigationEnd) { if (!e.url.includes('login')) { ...
Inborn asked 20/7, 2016 at 7:47

2

Solved

I am trying to mock a return value from a subscription's in my angular unit test. Found tons of example, but all are using spyOn in combination with .and.returnValue(of()). For spyOn i am getting ...
Extravasate asked 30/11, 2022 at 11:25

4

Solved

I am using ngxs for state handling in angular, and I am trying to test our components as units, so preferably only with mock stores, states etc. What we have in our component is something like: e...
Horsepower asked 28/6, 2018 at 11:39

16

Solved

I've been trying to run my tests using karma-chrome-launcher, but everytime I run my tests it throws this error: INFO [launcher]: Starting browser Chrome ERROR [launcher]: Cannot start Chrome INFO ...
Tasse asked 12/8, 2015 at 13:19

5

Solved

This weird error, that I don't remember seeing pre-Ivy, has popped up in the setup of a new app created with the latest Angular 9 CLI. Looks like it could be a bug with Ivy? Any ideas on how to fix...
Angadreme asked 26/2, 2020 at 8:1

5

Solved

I am getting an error while testing a component that is receiving an observable from the service, I have tried to mock that behaviour in the spec but I am getting the following error: Expression ha...
Parapsychology asked 22/2, 2017 at 5:5

1

I have a angularjs component, HTML template <div id="panel" class="hide-div"> <div id="viewPort" class="hide-div"> ... </div> </div> JS var myController = function()...
Vondavonni asked 17/5, 2018 at 18:57

5

In my TypeScript app I have a method that return an rxjs Observable which, in a certain case, can return throwError: import { throwError } from 'rxjs'; // ... getSomeData(inputValue): Observable...
Hovercraft asked 5/9, 2019 at 11:41

9

Solved

When testing using jasmine, I am getting this error. TypeError: moment().tz is not a function My code that I try to test is: let myDate = moment().tz(undefined, vm.timeZone).format('YYYY-MM-DD');...
Cramer asked 31/10, 2017 at 23:37

4

Solved

I have a Node.js app using TypeScript and now I want Jasmine to run tests automatically each time I make changes in .ts files. So I'm just trying to find an appropriate command to be run as npm tes...
Bunch asked 1/2, 2018 at 17:37

6

Solved

I'm getting this error when running jasmine tests on my Angular app. Error: StaticInjectorError(DynamicTestModule)[MyEditDialogComponent -> InjectionToken MatDialogData]: StaticInjectorError(...
Havens asked 18/9, 2019 at 15:48

2

Solved

First of, spyOnProperty is giving me Property user does not have access type get with this line: spyOnProperty(userService, 'user', 'get').and.returnValue(Observable.of(adminUser)); I have a UserS...
Chickamauga asked 28/2, 2018 at 16:33

2

Solved

I am trying to use intl to do some formatting but no matter what I pass in as the locale, I always get the following error message: ReferenceError: No locale data has been provided for this obje...
Lexine asked 13/6, 2017 at 8:57

6

Solved

I've been tasked with writing tests for a chat app developed with Angular. Below is the snippet of Angular template code I'm currently writing tests for: <div class="title-menu-container" fxL...
Wiltz asked 2/5, 2018 at 15:0

2

Solved

In a Content Projection scenario I have the following scenario: // my-component.ts @ContentChildren(SelectOption) selectOptions: QueryList<SelectOption>; ... ngAfterContentInit() { this.se...

© 2022 - 2024 — McMap. All rights reserved.