cucumberjs - How do i check a count value in chai-as-promised? -
i use cucumber , chai-as-promised assertion library. right way check count value. use equal works after converting string integer.is there way assert integer value directly?
this.then(/^the list should contain "([^"]*)" items$/, function (arg1, callback) { var count=parseint(arg1); expect(element.all(by.repeater('item in list.items')).count()).to.eventually.equal(count).and.notify(callback); });
if wanted to, believe bypass parseint() using chai's satisfy() method , javascript coercion, shown below. however, prefer method using easier understand , coercion can tricky.
this.then(/^the list should contain "([^"]*)" items$/, function (arg1, callback) { expect(element.all(by.repeater('item in list.items')).count()).to.eventually.satisfy(function(count) { return count == arg1 } ).and.notify(callback); });
Comments
Post a Comment