Node mocha array should contain an element

Should.js has the containEql method. In your case:

knownArray.should.containEql('known value');

The methods include, includes and contain you would find in chai.js.


Mostly from the mocha docs, you can do

var assert = require('assert');
var should = require('should');

describe('Array', function(){
  describe('#indexOf(thing)', function(){
    it('should not be -1 when thing is present', function(){
      [1,2,3].indexOf(3).should.not.equal(-1);
    });
  });
});

or if you don't mind not using should, you can always do

assert.notEqual(-1, knownArray.indexOf(thing));