Top "Jasmine" questions

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

Using Jasmine to spy on a function without an object

I'm new to Jasmine and have just started using it. I have a library js file with lots of functions …

javascript unit-testing jasmine
Jasmine.js comparing arrays

Is there a way in jasmine.js to check if two arrays are equal, for example: arr = [1, 2, 3] expect(arr).toBe([1, 2, 3]) …

javascript jasmine
toBe(true) vs toBeTruthy() vs toBeTrue()

What is the difference between expect(something).toBe(true), expect(something).toBeTruthy() and expect(something).toBeTrue()? Note that toBeTrue() is …

javascript testing jasmine protractor jasmine-matchers
Injecting a mock into an AngularJS service

I have an AngularJS service written and I would like to unit test it. angular.module('myServiceProvider', ['fooServiceProvider', 'barServiceProvider']). factory(…

javascript angularjs mocking jasmine angularjs-service
mocking window.location.href in Javascript

I have some unit tests for a function that makes use of the window.location.href -- not ideal I …

javascript mocking jasmine
Any way to modify Jasmine spies based on arguments?

I have a function I'd like to test which calls an external API method twice, using different parameters. I'd like …

javascript unit-testing jasmine
How do I focus on one spec in jasmine.js?

I have a bunch of failing specs from a rather large architectural change. I'd like to work on fixing them …

jasmine
Mocking AngularJS module dependencies in Jasmine unit tests

I'm attempting to unit test controller code inside a module that takes other modules as dependencies, but haven't been able …

unit-testing angularjs jasmine karma-runner
How do I change the timeout on a jasmine-node async spec

How can I get this test to pass without resorting to runs/waitsFor blocks? it("cannot change timeout", function(done) { …

node.js jasmine
How can I test that a value is "greater than or equal to" in Jasmine?

I want to confirm that a value is a decimal (or 0), so the number should be greater than or equal …

javascript tdd jasmine