unit testing - How do I test array element types using BDD Javascript? -


i writing javascript unit test using bdd style. want test value

  1. is array
  2. 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

Popular posts from this blog

xslt - Substring before throwing error -

Google Cloud Bigtable Durability/Availability Guarantees -

Android M doze mode and "native" posix socket freezing up -