forked from crossbario/autobahn-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_basic_async.js
41 lines (34 loc) · 1.06 KB
/
test_basic_async.js
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
29
30
31
32
33
34
35
36
37
38
39
40
41
///////////////////////////////////////////////////////////////////////////////
//
// AutobahnJS - http://autobahn.ws, http://wamp.ws
//
// A JavaScript library for WAMP ("The Web Application Messaging Protocol").
//
// Copyright (c) Crossbar.io Technologies GmbH and contributors
//
// Licensed under the MIT License.
// http://www.opensource.org/licenses/mit-license.php
//
///////////////////////////////////////////////////////////////////////////////
var autobahn = require('./../index.js');
var testutil = require('./testutil.js');
exports.testAsync = function (testcase) {
testcase.expect(1);
var test = new testutil.Testlog("test/test_basic_async.txt");
var d1 = autobahn.when.defer();
var d2 = autobahn.when.defer();
var df = autobahn.when.all([d1.promise, d2.promise]).then(
function (res) {
test.log(res);
var chk = test.check();
testcase.ok(!chk, chk);
testcase.done();
},
function (err) {
test.log(err);
testcase.done();
}
);
d1.resolve(23);
d2.resolve(42);
}