lundi 24 août 2015

loop through it() in jasmine describe output spec not found

I learned that this way is the best way to loop through the it() in a describe(), but it failed on me with "spec not found", and seems stop right before the for loop function, I wonder where did I do wrong?

Thanks!

describe('this is my looping test!', function() {
  var input = [1,2,3];
  var output = [10, 20, 30];

  function test_my_times_ten(input, output) {
    it('should multiply ' + input + ' by 10 to give ' + output, function() {
      expect(input * 10).toEqual(output)
    });
  }

  for(var x = 0; x < input.size; x++) {
    test_my_times_ten(input[x], output[x]);
  }
});

Aucun commentaire:

Enregistrer un commentaire