aboutsummaryrefslogtreecommitdiffstats
path: root/test/abi.parsers.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/abi.parsers.js')
-rw-r--r--test/abi.parsers.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/abi.parsers.js b/test/abi.parsers.js
index 19fa1d4cf..12bccf5a5 100644
--- a/test/abi.parsers.js
+++ b/test/abi.parsers.js
@@ -5,6 +5,7 @@ var clone = function (object) { return JSON.parse(JSON.stringify(object)); };
var description = [{
"name": "test",
+ "type": "function",
"inputs": [{
"name": "a",
"type": "uint256"
@@ -339,10 +340,12 @@ describe('abi', function() {
// given
var d = [{
name: "test",
+ type: "function",
inputs: [{ type: "int" }],
outputs: [{ type: "int" }]
},{
name: "test2",
+ type: "function",
inputs: [{ type: "string" }],
outputs: [{ type: "string" }]
}];
@@ -775,10 +778,12 @@ describe('abi', function() {
// given
var d = [{
name: "test",
+ type: "function",
inputs: [{ type: "int" }],
outputs: [{ type: "int" }]
},{
name: "test2",
+ type: "function",
inputs: [{ type: "string" }],
outputs: [{ type: "string" }]
}];
@@ -823,6 +828,38 @@ describe('abi', function() {
});
+ it('should parse 0x value', function () {
+
+ // given
+ var d = clone(description);
+ d[0].outputs = [
+ { type: 'int' }
+ ];
+
+ // when
+ var parser = abi.outputParser(d);
+
+ // then
+ assert.equal(parser.test("0x")[0], 0);
+
+ });
+
+ it('should parse 0x value', function () {
+
+ // given
+ var d = clone(description);
+ d[0].outputs = [
+ { type: 'uint' }
+ ];
+
+ // when
+ var parser = abi.outputParser(d);
+
+ // then
+ assert.equal(parser.test("0x")[0], 0);
+
+ });
+
});
});