summaryrefslogtreecommitdiff
path: root/mocha_test/constant.js
blob: 0852c19cd0d08056031f4e91168bd2e521668e4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
var async = require('./support/async');
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();
        });
    });

});