unit testing - How do I test array element types using BDD Javascript? -
i writing javascript unit test using bdd style. want test value
- is array
- has string elements
i can first condition with
value.should.be.an('array');
is there way test second condition using idiom?
i think clean way use array.prototype.every, give boolean value indicating if every value in array string. can use value in assertion.
value.every(function(el){ return typeof(el) === 'string'; }).should.be.true;
Comments
Post a Comment