Top "Jasmine" questions

Jasmine is a behavior-driven development (BDD) framework for testing JavaScript code.

Angular2 testing: What's the difference between a DebugElement and a NativeElement object in a ComponentFixture?

I'm currently putting together some best practices for testing Angular 2 apps on a component level. I've seen a few tutorials …

javascript unit-testing dom angular jasmine
Print message on expect() assert failure

Is there a way to print a custom error message when a Jasmine expect() fails? As an example, for end …

javascript testing jasmine protractor
How can I test that a function has not been called?

I'm testing router and have two functions, and I need to test if first function was called and second was …

javascript jasmine
Jasmine toEqual for complex objects (mixed with functions)

Currently, I have a function that sometimes return an object with some functions inside. When using expect(...).toEqual({...}) it doesn't …

jasmine matcher
Testing for instanceof using Jasmine

I'm new to Jasmine and testing in general. One block of my code checks whether my library has been instantiated …

javascript unit-testing testing jasmine
How to select an element in protractor having multiple classes?

I have a div like this: <div class="class1 class2 class3" ng-click="displayItems(category.categoryId, category.categoryDescription, category.associatedToElements, …

angularjs testing jasmine protractor end-to-end
Angular 5 Jasmine Error: Expected one matching request for criteria found none

I have a very simple service call and a jasmine test for it. Service call: myServiceCall(testId: number) : void { const …

angular jasmine angular-httpclient
How can I spy on a getter property using jasmine?

How can I spy on a getter property using jasmine? var o = { get foo() {}, }; spyOn(o, 'foo').and.returnValue('bar'); // …

javascript jasmine
angularjs route unit testing

As we see here in http://docs.angularjs.org/tutorial/step_07, angular.module('phonecat', []). config(['$routeProvider', function($routeProvider) { $routeProvider. …

angularjs unit-testing jasmine angularjs-routing
Mock window.location.reload in Jasmine testing

I have created a window.location.reload function in my javascript. I need to mock the reload function while testing …

mocking jasmine window.location