forked from web3/web3.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmethod.formatInput.js
41 lines (31 loc) · 1.04 KB
/
method.formatInput.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
var chai = require('chai');
var assert = chai.assert;
var Method = require('../lib/web3/method');
describe('lib/web3/method', function () {
describe('formatInput', function () {
it('should format plain input', function () {
// given
var star = function (arg) {
return arg + '*';
};
var method = new Method({
inputFormatter: [star, star, star]
});
var args = ['1','2','3'];
var expectedArgs = ['1*', '2*', '3*'];
// when
var result = method.formatInput(args);
// then
assert.deepEqual(result, expectedArgs);
});
it('should do nothing if there is no formatter', function () {
// given
var method = new Method({});
var args = [1,2,3];
// when
var result = method.formatInput(args);
// then
assert.deepEqual(result, args);
});
});
});