12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- /*
- * Should
- * Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca>
- * 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);
- });
- };
|