Top "Jasmine" questions

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

Unit testing AngularJS factories that have dependencies

When unit testing an Angular factory (with Karma + Jasmine), how do I inject a stub dependency into the factory under …

angularjs jasmine karma-runner
using Jasmines spyon upon a private method

is it possible to use Jasmine unit testing framework's spyon method upon a classes private methods? The documentation gives this …

javascript unit-testing jasmine
Mocking $httpBackend - how to handle "Unexpected request, No more request expected"?

I have a Jasmine test that is coded like this: it ("should send correct message to server to get data, …

angularjs jasmine karma-runner
How do you mock a service in AngularJS when unit testing with jasmine?

Let's say I have a service shop that depends on two stateful services schedule and warehouse. How do I inject …

unit-testing angularjs jasmine
How to have different return values for multiple calls on a Jasmine spy

Say I'm spying on a method like this: spyOn(util, "foo").andReturn(true); The function under test calls util.foo …

javascript unit-testing jasmine
TypeError: moment().tz is not a function

When testing using jasmine, I am getting this error. TypeError: moment.tz is not a function My code that I …

javascript unit-testing jasmine momentjs
AngularJS + Jasmine: Comparing objects

I'm just starting out writing tests for my AngularJS app and am doing so in Jasmine. Here are the relevant …

javascript unit-testing angularjs tdd jasmine
How to mock window.location.href with Jest + Vuejs?

Currently, I am implementing unit test for my project and there is a file that contained window.location.href. I …

unit-testing vue.js vuejs2 jasmine vue-test-utils
React Enzyme find second (or nth) node

I'm testing a React component with Jasmine Enzyme shallow rendering. Simplified here for the purposes of this question... function MyOuterComponent() { …

reactjs jasmine enzyme
Injecting dependent services when unit testing AngularJS services

I'm testing service A, but service A depends on service B (i.e. service B is injected into service A). …

javascript unit-testing angularjs jasmine karma-runner