/* * Should * Copyright(c) 2010-2014 TJ Holowaychuk * MIT Licensed */ module.exports = function(should, Assertion) { /** * Assert given object is exactly `true`. * * @name true * @memberOf Assertion * @category assertion bool * @alias Assertion#True * @example * * (true).should.be.true(); * false.should.not.be.true(); * * ({ a: 10}).should.not.be.true(); */ Assertion.add('true', function() { this.is.exactly(true); }); Assertion.alias('true', 'True'); /** * Assert given object is exactly `false`. * * @name false * @memberOf Assertion * @category assertion bool * @alias Assertion#False * @example * * (true).should.not.be.false(); * false.should.be.false(); */ Assertion.add('false', function() { this.is.exactly(false); }); Assertion.alias('false', 'False'); /** * Assert given object is thuthy according javascript type conversions. * * @name ok * @memberOf Assertion * @category assertion bool * @example * * (true).should.be.ok(); * ''.should.not.be.ok(); * should(null).not.be.ok(); * should(void 0).not.be.ok(); * * (10).should.be.ok(); * (0).should.not.be.ok(); */ Assertion.add('ok', function() { this.params = { operator: 'to be truthy' }; this.assert(this.obj); }); };