Skip to content

FrankyBoy/jasmine-params

 
 

Repository files navigation

jasmine-params

Parameterization for jasmine tests

Based on Neckbeard.js
Allows BDD style looping in your jasmine specifications.

Usage

setting up the loop ...

you can loop with one variable

loop2 = jparams.iterate('num').values(1,2,3,4);

or with multiple variables

loop = jparams
    .iterate('first', 'second', 'expected')
    .values([3,  3,  6],
            [10, 4, 14],
            [7,  1,  8]);

using the loop ...

loop.it('runs for number #num', function(num){
  expect(num).toBeGreaterThan(0);
});

or for multiple values

loop.it('#first + #second should be #expected', function(first, second, expected){
  expect(first + second).toBe(expected);
});

using with async tests

If the passed function has one argument more than defined in the iterate, the last argument will be used to pass the done value. See the spec for an example.

supported methods

  • it
  • iit
  • xit
  • describe
  • ddescribe
  • xdescribe

About

Parameterization for jasmine tests

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%