Skip to content

Latest commit

 

History

History
23 lines (14 loc) · 432 Bytes

File metadata and controls

23 lines (14 loc) · 432 Bytes

a (aka: "an")

  • to[.not].be.a

The a or (an) assertion is useful for type matching. For example:

expect(a).to.be.an('array');
expect(b).to.be.a('boolean');

Type names are derived from Object.prototype.toString.

Alternatively, a constructor can be passed:

class T {
    // ...
}

var t = new T();
expect(t).to.be.a(T);

The above is equivalent to:

expect(t instanceof T).to.be(true);