forked from web3/web3.js
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmethod.getCall.js
More file actions
46 lines (35 loc) · 1.13 KB
/
method.getCall.js
File metadata and controls
46 lines (35 loc) · 1.13 KB
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
42
43
44
45
var chai = require('chai');
var assert = chai.assert;
var Method = require('../lib/web3/method');
describe('lib/web3/method', function () {
describe('getCall', function () {
it('should return call name', function () {
// given
var call = 'hello_call_world';
var method = new Method({
call: call
});
// when
var result = method.getCall();
// then
assert.equal(call, result);
});
it('should return call based on args', function () {
// given
var call = function (args) {
return args ? args.length.toString() : '0';
};
var method = new Method({
call: call
});
// when
var r0 = method.getCall();
var r1 = method.getCall([1]);
var r2 = method.getCall([1, 2]);
// then
assert.equal(r0, '0');
assert.equal(r1, '1');
assert.equal(r2, '2');
});
});
});