diff options
Diffstat (limited to 'mocha_test/constant.js')
-rw-r--r-- | mocha_test/constant.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/mocha_test/constant.js b/mocha_test/constant.js new file mode 100644 index 0000000..d76076c --- /dev/null +++ b/mocha_test/constant.js @@ -0,0 +1,28 @@ +var async = require('../lib'); +var expect = require('chai').expect; + +describe('constant', function () { + + it('basic usage', function(done){ + var f = async.constant(42, 1, 2, 3); + f(function (err, value, a, b, c) { + expect(err).to.equal(null); + expect(value).to.equal(42); + expect(a).to.equal(1); + expect(b).to.equal(2); + expect(c).to.equal(3); + done(); + }); + }); + + it('called with multiple arguments', function(done){ + var f = async.constant(42, 1, 2, 3); + f('argument to ignore', 'another argument', function (err, value, a) { + expect(err).to.equal(null); + expect(value).to.equal(42); + expect(a).to.equal(1); + done(); + }); + }); + +}); |