mirror of
https://github.com/status-im/web3.js.git
synced 2025-02-24 03:58:13 +00:00
Changing abi tests to use fixed bytes type
This commit is contained in:
parent
6554479d43
commit
760634a1cd
@ -227,56 +227,6 @@ describe('abi', function() {
|
||||
|
||||
});
|
||||
|
||||
it('should parse input hash', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].inputs = [
|
||||
{ type: "hash" }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.inputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test("0x407d73d8a49eeb85d32cf465507dd71d507100c1"), "000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1");
|
||||
|
||||
});
|
||||
|
||||
it('should parse input hash256', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].inputs = [
|
||||
{ type: "hash256" }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.inputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test("0x407d73d8a49eeb85d32cf465507dd71d507100c1"), "000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1");
|
||||
|
||||
});
|
||||
|
||||
|
||||
it('should parse input hash160', function() {
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].inputs = [
|
||||
{ type: "hash160" }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.inputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test("0x407d73d8a49eeb85d32cf465507dd71d507100c1"), "000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1");
|
||||
});
|
||||
|
||||
it('should parse input address', function () {
|
||||
|
||||
// given
|
||||
@ -294,13 +244,13 @@ describe('abi', function() {
|
||||
|
||||
});
|
||||
|
||||
it('should parse input string', function () {
|
||||
it('should parse input fixed bytes type', function () {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].inputs = [
|
||||
{ type: "string" }
|
||||
{ type: "bytes32" }
|
||||
];
|
||||
|
||||
// when
|
||||
@ -318,14 +268,14 @@ describe('abi', function() {
|
||||
);
|
||||
});
|
||||
|
||||
it('should parse input int followed by a string', function () {
|
||||
it('should parse input int followed by a fixed bytes type', function () {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].inputs = [
|
||||
{ type: "int" },
|
||||
{ type: "string" }
|
||||
{ type: "bytes32" }
|
||||
];
|
||||
|
||||
// when
|
||||
@ -340,13 +290,13 @@ describe('abi', function() {
|
||||
);
|
||||
});
|
||||
|
||||
it('should parse input string followed by an int', function () {
|
||||
it('should parse input fixed bytes type followed by an int', function () {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].inputs = [
|
||||
{ type: "string" },
|
||||
{ type: "bytes32" },
|
||||
{ type: "int" }
|
||||
];
|
||||
|
||||
@ -391,8 +341,8 @@ describe('abi', function() {
|
||||
},{
|
||||
name: "test2",
|
||||
type: "function",
|
||||
inputs: [{ type: "string" }],
|
||||
outputs: [{ type: "string" }]
|
||||
inputs: [{ type: "bytes32" }],
|
||||
outputs: [{ type: "bytes32" }]
|
||||
}];
|
||||
|
||||
// when
|
||||
|
@ -21,13 +21,13 @@ var description = [{
|
||||
|
||||
describe('abi', function() {
|
||||
describe('outputParser', function() {
|
||||
it('should parse output string', function() {
|
||||
it('should parse output fixed bytes type', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].outputs = [
|
||||
{ type: "string" }
|
||||
{ type: "bytes32" }
|
||||
];
|
||||
|
||||
// when
|
||||
@ -181,64 +181,6 @@ describe('abi', function() {
|
||||
assert.equal(parser.test("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0")[0], -16);
|
||||
});
|
||||
|
||||
it('should parse output hash', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].outputs = [
|
||||
{ type: 'hash' }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(
|
||||
parser.test("0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1")[0],
|
||||
"0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1"
|
||||
);
|
||||
});
|
||||
|
||||
it('should parse output hash256', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].outputs = [
|
||||
{ type: 'hash256' }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(
|
||||
parser.test("0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1")[0],
|
||||
"0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1"
|
||||
);
|
||||
});
|
||||
|
||||
it('should parse output hash160', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].outputs = [
|
||||
{ type: 'hash160' }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(
|
||||
parser.test("0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1")[0],
|
||||
"0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1"
|
||||
);
|
||||
// TODO shouldnt' the expected hash be shorter?
|
||||
});
|
||||
|
||||
it('should parse output address', function() {
|
||||
|
||||
// given
|
||||
@ -317,14 +259,14 @@ describe('abi', function() {
|
||||
});
|
||||
|
||||
|
||||
it('should parse multiple output strings', function() {
|
||||
it('should parse multiple output fixed bytes type', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].outputs = [
|
||||
{ type: "string" },
|
||||
{ type: "string" }
|
||||
{ type: "bytes32" },
|
||||
{ type: "bytes32" }
|
||||
];
|
||||
|
||||
// when
|
||||
@ -380,8 +322,8 @@ describe('abi', function() {
|
||||
},{
|
||||
name: "test2",
|
||||
type: "function",
|
||||
inputs: [{ type: "string" }],
|
||||
outputs: [{ type: "string" }]
|
||||
inputs: [{ type: "bytes32" }],
|
||||
outputs: [{ type: "bytes32" }]
|
||||
}];
|
||||
|
||||
// when
|
||||
|
Loading…
x
Reference in New Issue
Block a user