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

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -