I am writing a Javascript unit test using the BDD style. I want to test that a value
- is an array
- has all string elements
I can get the first condition with
value.should.be.an('array');
Is there a way to test for the second condition using this idiom?
I think a clean way to do it would be to use Array.prototype.every, which would give you a boolean value indicating if every value in the array was a string. You can then use this value in your assertion.