1

I have the following test:

describe('when invoked', function() {
  it('should check something', function() {
    _.each(someData, function(obj, index) {
      expect(obj[index].lable).toBe('foo');
    });
  });
});

When I run Jasmine 2.2.0 it get the following error:

Spec 'SpecLabel function when invoked return value should check something' has no expectations.

Am I missing something? In Jasmin 1.x we could do this. Have expect inside a for each, or even a for loop.

How can I fix these type of tests? And what are the docs for these situations? The Jasmine website is not really helpful.

RaduM
  • 2,551
  • 3
  • 21
  • 24

1 Answers1

1

A quick workaround can be refactoring your tests to:

describe('when invoked', function () {
    it('should check something', function () {
        var success = true;
        _.each(someData, function (obj, index) {
            success &= obj[index].lable === 'foo';
        });
        expect(success).toBeTruthy();
    });
});
user1253128
  • 61
  • 1
  • 1