From 2e79ce26cbeacdeb0ea52b7c2e3da68e8055e7c6 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Mon, 26 Nov 2018 18:00:05 -0800 Subject: Tests use to.be.deep.equal instead of JSON --- .../utils/test/abi_encoder/evm_data_types_test.ts | 176 ++++++--------------- packages/utils/test/abi_encoder/methods_test.ts | 72 +++------ packages/utils/test/abi_encoder/optimizer_test.ts | 64 ++------ .../utils/test/abi_encoder/return_values_test.ts | 24 +-- 4 files changed, 84 insertions(+), 252 deletions(-) (limited to 'packages/utils') diff --git a/packages/utils/test/abi_encoder/evm_data_types_test.ts b/packages/utils/test/abi_encoder/evm_data_types_test.ts index 7cea86529..b99500265 100644 --- a/packages/utils/test/abi_encoder/evm_data_types_test.ts +++ b/packages/utils/test/abi_encoder/evm_data_types_test.ts @@ -24,9 +24,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Dynamic size; Static elements', async () => { // Create DataType object @@ -41,9 +39,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Fixed size; Dynamic elements', async () => { // Create DataType object @@ -58,9 +54,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Dynamic size; Dynamic elements', async () => { // Create DataType object @@ -75,9 +69,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Dynamic Size; Multidimensional; Dynamic Elements', async () => { // Create DataType object @@ -95,9 +87,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Dynamic Size; Multidimensional; Static Elements', async () => { // Create DataType object @@ -115,9 +105,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Static Size; Multidimensional; Static Elements', async () => { // Create DataType object @@ -134,9 +122,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Static Size; Multidimensional; Dynamic Elements', async () => { // Create DataType object @@ -153,9 +139,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Static size; Too Few Elements', async () => { // Create DataType object @@ -211,9 +195,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { // Decode Encoded Args and validate result const decodingRules: AbiEncoder.DecodingRules = { structsAsObjects: true }; const decodedArgs = dataType.decode(encodedArgs, decodingRules); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Dynamic elements only', async () => { // Create DataType object @@ -233,9 +215,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { // Decode Encoded Args and validate result const decodingRules: AbiEncoder.DecodingRules = { structsAsObjects: true }; const decodedArgs = dataType.decode(encodedArgs, decodingRules); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Nested Static Array', async () => { // Create DataType object @@ -255,9 +235,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { // Decode Encoded Args and validate result const decodingRules: AbiEncoder.DecodingRules = { structsAsObjects: true }; const decodedArgs = dataType.decode(encodedArgs, decodingRules); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Nested Dynamic Array', async () => { // Create DataType object @@ -277,9 +255,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { // Decode Encoded Args and validate result const decodingRules: AbiEncoder.DecodingRules = { structsAsObjects: true }; const decodedArgs = dataType.decode(encodedArgs, decodingRules); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Nested Static Multidimensional Array', async () => { // Create DataType object @@ -301,9 +277,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { // Decode Encoded Args and validate result const decodingRules: AbiEncoder.DecodingRules = { structsAsObjects: true }; const decodedArgs = dataType.decode(encodedArgs, decodingRules); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Nested Dynamic Multidimensional Array', async () => { // Create DataType object @@ -325,9 +299,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { // Decode Encoded Args and validate result const decodingRules: AbiEncoder.DecodingRules = { structsAsObjects: true }; const decodedArgs = dataType.decode(encodedArgs, decodingRules); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Static and dynamic elements mixed', async () => { // Create DataType object @@ -357,9 +329,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { // Decode Encoded Args and validate result const decodingRules: AbiEncoder.DecodingRules = { structsAsObjects: true }; const decodedArgs = dataType.decode(encodedArgs, decodingRules); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Missing Key', async () => { // Create DataType object @@ -406,9 +376,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Invalid Address - input is not valid hex', async () => { // Create DataType object @@ -447,9 +415,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('False', async () => { // Create DataType object @@ -463,9 +429,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); }); @@ -489,9 +453,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Int256 - Negative Base Case', async () => { // Create DataType object @@ -505,9 +467,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Int256 - Positive Value', async () => { // Create DataType object @@ -521,9 +481,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Int256 - Negative Value', async () => { // Create DataType object @@ -537,9 +495,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Int256 - Value too large', async () => { // Create DataType object @@ -575,9 +531,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Int32 - Negative Base Case', async () => { // Create DataType object @@ -591,9 +545,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Int32 - Positive Value', async () => { // Create DataType object @@ -607,9 +559,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Int32 - Negative Value', async () => { // Create DataType object @@ -623,9 +573,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Int32 - Value too large', async () => { // Create DataType object @@ -671,9 +619,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('UInt256 - Positive Value', async () => { // Create DataType object @@ -687,9 +633,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('UInt256 - Zero Value', async () => { // Create DataType object @@ -703,9 +647,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('UInt256 - Value too large', async () => { // Create DataType object @@ -741,9 +683,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('UInt32 - Positive Value', async () => { // Create DataType object @@ -757,9 +697,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('UInt32 - Zero Value', async () => { // Create DataType object @@ -773,9 +711,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('UInt32 - Value too large', async () => { // Create DataType object @@ -814,9 +750,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Single Byte (bytes1)', async () => { // Create DataType object @@ -830,9 +764,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('4 Bytes (bytes4)', async () => { // Create DataType object @@ -846,9 +778,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('4 Bytes (bytes4); Encoder must pad input', async () => { // Create DataType object @@ -863,10 +793,8 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); const paddedArgs = '0x1a180000'; - const paddedArgsAsJson = JSON.stringify(paddedArgs); - expect(decodedArgsAsJson).to.be.equal(paddedArgsAsJson); + expect(decodedArgs).to.be.deep.equal(paddedArgs); }); it('32 Bytes (bytes32)', async () => { // Create DataType object @@ -880,9 +808,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('32 Bytes (bytes32); Encoder must pad input', async () => { // Create DataType object @@ -897,10 +823,8 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); const paddedArgs = '0x1a18bf6100000000000000000000000000000000000000000000000000000000'; - const paddedArgsAsJson = JSON.stringify(paddedArgs); - expect(decodedArgsAsJson).to.be.equal(paddedArgsAsJson); + expect(decodedArgs).to.be.deep.equal(paddedArgs); }); it('Should throw when pass in too many bytes (bytes4)', async () => { // Create DataType object @@ -967,9 +891,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Spans multiple EVM words', async () => { // Create DataType object @@ -986,9 +908,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Input as Buffer', async () => { // Create DataType object @@ -1005,9 +925,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Should throw when pass in bad hex (no 0x prefix)', async () => { // Create DataType object @@ -1048,9 +966,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Spans multiple EVM words', async () => { // Create DataType object @@ -1067,9 +983,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('String that begins with 0x prefix', async () => { // Create DataType object @@ -1086,9 +1000,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result const decodedArgs = dataType.decode(encodedArgs); - const decodedArgsAsJson = JSON.stringify(decodedArgs); - const argsAsJson = JSON.stringify(args); - expect(decodedArgsAsJson).to.be.equal(argsAsJson); + expect(decodedArgs).to.be.deep.equal(args); }); }); }); diff --git a/packages/utils/test/abi_encoder/methods_test.ts b/packages/utils/test/abi_encoder/methods_test.ts index d158b9e5b..c870f4f04 100644 --- a/packages/utils/test/abi_encoder/methods_test.ts +++ b/packages/utils/test/abi_encoder/methods_test.ts @@ -20,10 +20,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => { '0x09f2b0c30000000000000000000000000000000000000000000000000000000000000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff560000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000000000015600000000000000000000000000000000000000000000000000000000000000'; expect(calldata).to.be.equal(expectedCalldata); // Validate decoding - const expectedDecodedValueJson = JSON.stringify(args); const decodedValue = method.decode(calldata); - const decodedValueJson = JSON.stringify(decodedValue); - expect(decodedValueJson).to.be.equal(expectedDecodedValueJson); + expect(decodedValue).to.be.deep.equal(args); }); it('Array of Static Tuples (Array has defined length)', async () => { // Generate calldata @@ -41,10 +39,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => { '0x9eb20969000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000010'; expect(calldata).to.be.equal(expectedCalldata); // Validate decoding - const expectedDecodedValueJson = JSON.stringify(args); const decodedValue = method.decode(calldata); - const decodedValueJson = JSON.stringify(decodedValue); - expect(decodedValueJson).to.be.equal(expectedDecodedValueJson); + expect(decodedValue).to.be.deep.equal(args); }); it('Array of Static Tuples (Array has dynamic length)', async () => { // Generate calldata @@ -62,10 +58,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => { '0x63275d6e00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000010'; expect(calldata).to.be.equal(expectedCalldata); // Validate decoding - const expectedDecodedValueJson = JSON.stringify(args); const decodedValue = method.decode(calldata); - const decodedValueJson = JSON.stringify(decodedValue); - expect(decodedValueJson).to.be.equal(expectedDecodedValueJson); + expect(decodedValue).to.be.deep.equal(args); }); it('Array of Dynamic Tuples (Array has defined length)', async () => { // Generate Calldata @@ -83,10 +77,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => { '0xdeedb00f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000280000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000132000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000013400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023130000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023132000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023134000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023136000000000000000000000000000000000000000000000000000000000000'; expect(calldata).to.be.equal(expectedCalldata); // Validate decoding - const expectedDecodedValueJson = JSON.stringify(args); const decodedValue = method.decode(calldata); - const decodedValueJson = JSON.stringify(decodedValue); - expect(decodedValueJson).to.be.equal(expectedDecodedValueJson); + expect(decodedValue).to.be.deep.equal(args); }); it('Array of Dynamic Tuples (Array has dynamic length)', async () => { // Generate calldata @@ -104,10 +96,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => { '0x60c847fb000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000280000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000132000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000013400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023130000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023132000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023134000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023136000000000000000000000000000000000000000000000000000000000000'; expect(calldata).to.be.equal(expectedCalldata); // Validate decoding - const expectedDecodedValueJson = JSON.stringify(args); const decodedValue = method.decode(calldata); - const decodedValueJson = JSON.stringify(decodedValue); - expect(decodedValueJson).to.be.equal(expectedDecodedValueJson); + expect(decodedValue).to.be.deep.equal(args); }); it('Multidimensional Arrays / Static Members', async () => { // Generate calldata @@ -129,10 +119,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => { expect(calldata).to.be.equal(expectedCalldata); expect(calldata).to.be.equal(expectedCalldata); // Validate decoding - const expectedDecodedValueJson = JSON.stringify(args); const decodedValue = method.decode(calldata); - const decodedValueJson = JSON.stringify(decodedValue); - expect(decodedValueJson).to.be.equal(expectedDecodedValueJson); + expect(decodedValue).to.be.deep.equal(args); }); it('Multidimensional Arrays / Dynamic Members', async () => { // Generate calldata @@ -159,10 +147,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => { '0x81534ebd0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000052000000000000000000000000000000000000000000000000000000000000009a00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000131000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000013300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000134000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001350000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000013600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000137000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001380000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000139000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002313000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000023131000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000231320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000002313300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023134000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000231350000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002313600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000231370000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002313800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000023139000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000232300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000023231000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000232320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000002323300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023234000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000232350000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002323600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000232370000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002323800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000002323900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000002333100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023332000000000000000000000000000000000000000000000000000000000000'; expect(calldata).to.be.equal(expectedCalldata); // Validate decoding - const expectedDecodedValueJson = JSON.stringify(args); const decodedValue = method.decode(calldata); - const decodedValueJson = JSON.stringify(decodedValue); - expect(decodedValueJson).to.be.equal(expectedDecodedValueJson); + expect(decodedValue).to.be.deep.equal(args); }); it('Fixed Length Array / Dynamic Members', async () => { // Generate calldata @@ -174,10 +160,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => { '0x243a6e6e0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000005427261766500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034e657700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005576f726c64000000000000000000000000000000000000000000000000000000'; expect(calldata).to.be.equal(expectedCalldata); // Validate decoding - const expectedDecodedValueJson = JSON.stringify(args); const decodedValue = method.decode(calldata); - const decodedValueJson = JSON.stringify(decodedValue); - expect(decodedValueJson).to.be.equal(expectedDecodedValueJson); + expect(decodedValue).to.be.deep.equal(args); }); it('Fixed Length Array / Dynamic Members', async () => { // Generaet calldata @@ -189,10 +173,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => { '0x243a6e6e0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000005427261766500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034e657700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005576f726c64000000000000000000000000000000000000000000000000000000'; expect(calldata).to.be.equal(expectedCalldata); // Validate decoding - const expectedDecodedValueJson = JSON.stringify(args); const decodedValue = method.decode(calldata); - const decodedValueJson = JSON.stringify(decodedValue); - expect(decodedValueJson).to.be.equal(expectedDecodedValueJson); + expect(decodedValue).to.be.deep.equal(args); }); it('Unfixed Length Array / Dynamic Members ABI', async () => { // Generate calldata @@ -204,10 +186,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => { '0x13e751a900000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000005427261766500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034e657700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005576f726c64000000000000000000000000000000000000000000000000000000'; expect(calldata).to.be.equal(expectedCalldata); // Validate decoding - const expectedDecodedValueJson = JSON.stringify(args); const decodedValue = method.decode(calldata); - const decodedValueJson = JSON.stringify(decodedValue); - expect(decodedValueJson).to.be.equal(expectedDecodedValueJson); + expect(decodedValue).to.be.deep.equal(args); }); it('Unfixed Length Array / Static Members ABI', async () => { // Generate calldata @@ -219,10 +199,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => { '0x4fc8a83300000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000036'; expect(calldata).to.be.equal(expectedCalldata); // Validate decoding - const expectedDecodedValueJson = JSON.stringify(args); const decodedValue = method.decode(calldata); - const decodedValueJson = JSON.stringify(decodedValue); - expect(decodedValueJson).to.be.equal(expectedDecodedValueJson); + expect(decodedValue).to.be.deep.equal(args); }); it('Fixed Length Array / Static Members ABI', async () => { // Generate calldata @@ -234,10 +212,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => { '0xf68ade72000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000036'; expect(calldata).to.be.equal(expectedCalldata); // Validate decoding - const expectedDecodedValueJson = JSON.stringify(args); const decodedValue = method.decode(calldata); - const decodedValueJson = JSON.stringify(decodedValue); - expect(decodedValueJson).to.be.equal(expectedDecodedValueJson); + expect(decodedValue).to.be.deep.equal(args); }); it('Array ABI', async () => { // Generate calldata @@ -249,10 +225,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => { '0x13e751a900000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000046669766500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000373697800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005736576656e000000000000000000000000000000000000000000000000000000'; expect(calldata).to.be.equal(expectedCalldata); // Validate decoding - const expectedDecodedValueJson = JSON.stringify(args); const decodedValue = method.decode(calldata); - const decodedValueJson = JSON.stringify(decodedValue); - expect(decodedValueJson).to.be.equal(expectedDecodedValueJson); + expect(decodedValue).to.be.deep.equal(args); }); it('Static Tuple', async () => { // Generate calldata @@ -265,10 +239,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => { '0xa9125e150000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000000'; expect(calldata).to.be.equal(expectedCalldata); // Validate decoding - const expectedDecodedValueJson = JSON.stringify(args); const decodedValue = method.decode(calldata); - const decodedValueJson = JSON.stringify(decodedValue); - expect(decodedValueJson).to.be.equal(expectedDecodedValueJson); + expect(decodedValue).to.be.deep.equal(args); }); it('Dynamic Tuple (Array input)', async () => { // Generate calldata @@ -281,10 +253,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => { '0x5b998f3500000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000046669766500000000000000000000000000000000000000000000000000000000'; expect(calldata).to.be.equal(expectedCalldata); // Validate decoding - const expectedDecodedValueJson = JSON.stringify(args); const decodedValue = method.decode(calldata); - const decodedValueJson = JSON.stringify(decodedValue); - expect(decodedValueJson).to.be.equal(expectedDecodedValueJson); + expect(decodedValue).to.be.deep.equal(args); }); it('Dynamic Tuple (Object input)', async () => { // Generate Calldata @@ -297,10 +267,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => { '0x5b998f3500000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000046669766500000000000000000000000000000000000000000000000000000000'; expect(calldata).to.be.equal(expectedCalldata); // Validate decoding - const expectedDecodedValueJson = JSON.stringify(args); const decodedValue = method.decode(calldata); - const decodedValueJson = JSON.stringify(decodedValue); - expect(decodedValueJson).to.be.equal(expectedDecodedValueJson); + expect(decodedValue).to.be.deep.equal(args); }); it('Large, Flat ABI', async () => { // Construct calldata @@ -322,10 +290,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => { '0x312d4d42000000000000000000000000000000000000000000000000000000000f4d9feefffffffffffffffffffffffffffffffffffffffffffffffffffffffff0b26012000000000000000000000000000000000000000000000000000000000006a0444300000000000000000000000000000000000000000000000000000000000000000102030405060708091112131415161718192021222324252627282930313200000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000180000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f4980000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000003800010203040506070809111213141516171819202122232425262728293031320809111213141516171819202122232425262728293031320000000000000000000000000000000000000000000000000000000000000000000000000000002c4c6974746c65207065746572207069706572207069706564206120706970696e672070657070657220706f740000000000000000000000000000000000000000'; expect(calldata).to.be.equal(expectedCalldata); // Validate decoding - const expectedDecodedValueJson = JSON.stringify(args); const decodedValue = method.decode(calldata); - const decodedValueJson = JSON.stringify(decodedValue); - expect(decodedValueJson).to.be.equal(expectedDecodedValueJson); + expect(decodedValue).to.be.deep.equal(args); }); it('Large, Nested ABI', async () => { // Construct Calldata @@ -393,9 +359,7 @@ describe('ABI Encoder: Method Encoding / Decoding', () => { '0x4b49031c000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000440000000000000000000000000000000000000000000000000000000000000088000000000000000000000000000000000000000000000000000000000000009800000000000000000000000000000000000000000000000000000000000000ae0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000034746865206c6974746c6520706970696e67207069706572207069706564206120706970696e6720706970706572207061707065720000000000000000000000000000000000000000000000000000000000000000000000000000000000000081746865206b6964206b6e6f777320686f7720746f20777269746520706f656d732c20776861742063616e204920736179202d2d2049206775657373207468657265732061206c6f74204920636f756c642073617920746f2074727920746f2066696c6c2074686973206c696e6520776974682061206c6f74206f6620746578742e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000163874563783498732482743928742389723894723984700000000000000000000000000000000000000000000000000000000000000000000000000000000006e72834723982374239847239847298472489274987489742847289472394874987498478743294237434923473298472398423748923748923748923472389472894789474893742894728947389427498237432987423894723894732894723894372498237498237428934723980000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000027283473298473248923749238742398742398472894729843278942374982374892374892743982000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000000b736f6d6520737472696e670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000013736f6d6520616e6f7468657220737472696e67000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024746865726520617265206a75737420746f6f206d616e7920737472696e6773757020696e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000046865726500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002079616c6c2067686f6e6e61206d616b65206d65206c6f7365206d79206d696e640000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000034746865206c6974746c6520706970696e67207069706572207069706564206120706970696e6720706970706572207061707065720000000000000000000000000000000000000000000000000000000000000000000000000000000000000081746865206b6964206b6e6f777320686f7720746f20777269746520706f656d732c20776861742063616e204920736179202d2d2049206775657373207468657265732061206c6f74204920636f756c642073617920746f2074727920746f2066696c6c2074686973206c696e6520776974682061206c6f74206f6620746578742e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f0ac511500000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000081746865206b6964206b6e6f777320686f7720746f20777269746520706f656d732c20776861742063616e204920736179202d2d2049206775657373207468657265732061206c6f74204920636f756c642073617920746f2074727920746f2066696c6c2074686973206c696e6520776974682061206c6f74206f6620746578742e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003d69d500000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000100000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498000000000000000000000000000000000000000000000000000000000000004e616b64686a61736a6b646861736a6b6c647368646a6168646b6a73616864616a6b73646873616a6b646873616a6b646861646a6b617368646a6b73616468616a6b646873616a6b64687361646a6b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002829384723894723843743289742389472398473289472348927489274894738427428947389facdea0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000089b51500000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000100000000000000000000000000746dafa5ebde1f4699f4981d3221892e41d24895000000000000000000000000000000000000000000000000000000000000004e6b73646873616a6b646873616a6b646861646a6b617368646a6b73616468616a6b646873616a6b64687361646a6b616b64686a61736a6b646861736a6b6c647368646a6168646b6a73616864616a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002829384723894398473289472348927489272384374328974238947274894738427428947389facde100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000fa3150000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000010000000000000000000000000089571d322189e415ebde1f4699f498d24246dafa000000000000000000000000000000000000000000000000000000000000004e73646873616a6b646873616a6b646861646a6b617368646a616b64686a61736a6b646861736a6b6c647368646a6168646b6a73616864616a6b6b73616468616a6b646873616a6b64687361646a6b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002838947238437432829384729742389472398473289472348927489274894738427428947389facdef000000000000000000000000000000000000000000000000'; expect(calldata).to.be.equal(expectedCalldata); // Validate decoding - const expectedDecodedValueJson = JSON.stringify(args); const decodedValue = method.decode(calldata, { structsAsObjects: true }); - const decodedValueJson = JSON.stringify(decodedValue); - expect(decodedValueJson).to.be.equal(expectedDecodedValueJson); + expect(decodedValue).to.be.deep.equal(args); }); }); diff --git a/packages/utils/test/abi_encoder/optimizer_test.ts b/packages/utils/test/abi_encoder/optimizer_test.ts index 304c9cbc2..27443fe48 100644 --- a/packages/utils/test/abi_encoder/optimizer_test.ts +++ b/packages/utils/test/abi_encoder/optimizer_test.ts @@ -23,9 +23,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => { expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata); // Validate decoding const decodedArgs = method.decode(optimizedCalldata); - const decodedArgsJson = JSON.stringify(decodedArgs); - const argsJson = JSON.stringify(args); - expect(decodedArgsJson).to.be.equal(argsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Duplicate Dynamic Arrays with Dynamic Elements', async () => { // Generate calldata @@ -40,9 +38,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => { expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata); // Validate decoding const decodedArgs = method.decode(optimizedCalldata); - const decodedArgsJson = JSON.stringify(decodedArgs); - const argsJson = JSON.stringify(args); - expect(decodedArgsJson).to.be.equal(argsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Duplicate Static Arrays with Static Elements (should not optimize)', async () => { // Generate calldata @@ -59,9 +55,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => { expect(optimizedCalldata).to.be.equal(unoptimizedCalldata); // Validate decoding const decodedArgs = method.decode(optimizedCalldata); - const decodedArgsJson = JSON.stringify(decodedArgs); - const argsJson = JSON.stringify(args); - expect(decodedArgsJson).to.be.equal(argsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Duplicate Static Arrays with Dynamic Elements', async () => { // Generate calldata @@ -76,9 +70,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => { expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata); // Validate decoding const decodedArgs = method.decode(optimizedCalldata); - const decodedArgsJson = JSON.stringify(decodedArgs); - const argsJson = JSON.stringify(args); - expect(decodedArgsJson).to.be.equal(argsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Duplicate Array Elements (should optimize)', async () => { // Generate calldata @@ -92,9 +84,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => { expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata); // Validate decoding const decodedArgs = method.decode(optimizedCalldata); - const decodedArgsJson = JSON.stringify(decodedArgs); - const argsJson = JSON.stringify(args); - expect(decodedArgsJson).to.be.equal(argsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Duplicate Tuple Fields', async () => { // Generate calldata @@ -108,9 +98,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => { expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata); // Validate decoding const decodedArgs = method.decode(optimizedCalldata); - const decodedArgsJson = JSON.stringify(decodedArgs); - const argsJson = JSON.stringify(args); - expect(decodedArgsJson).to.be.equal(argsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Duplicate Strings', async () => { // Description: @@ -127,9 +115,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => { expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata); // Validate decoding const decodedArgs = method.decode(optimizedCalldata); - const decodedArgsJson = JSON.stringify(decodedArgs); - const argsJson = JSON.stringify(args); - expect(decodedArgsJson).to.be.equal(argsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Duplicate Bytes', async () => { // Description: @@ -147,9 +133,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => { expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata); // Validate decoding const decodedArgs = method.decode(optimizedCalldata); - const decodedArgsJson = JSON.stringify(decodedArgs); - const argsJson = JSON.stringify(args); - expect(decodedArgsJson).to.be.equal(argsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Duplicate Tuples', async () => { // Generate calldata @@ -164,9 +148,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => { expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata); // Validate decoding const decodedArgs = method.decode(optimizedCalldata); - const decodedArgsJson = JSON.stringify(decodedArgs); - const argsJson = JSON.stringify(args); - expect(decodedArgsJson).to.be.equal(argsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Duplicate Fields Across Two Tuples', async () => { // Description: @@ -182,9 +164,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => { expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata); // Validate decoding const decodedArgs = method.decode(optimizedCalldata); - const decodedArgsJson = JSON.stringify(decodedArgs); - const argsJson = JSON.stringify(args); - expect(decodedArgsJson).to.be.equal(argsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Duplicate Arrays, Nested in Separate Tuples', async () => { // Generate calldata @@ -200,9 +180,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => { expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata); // Validate decoding const decodedArgs = method.decode(optimizedCalldata); - const decodedArgsJson = JSON.stringify(decodedArgs); - const argsJson = JSON.stringify(args); - expect(decodedArgsJson).to.be.equal(argsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Duplicate Tuples, Nested in Separate Tuples', async () => { // Generate calldata @@ -218,9 +196,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => { expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata); // Validate decoding const decodedArgs = method.decode(optimizedCalldata); - const decodedArgsJson = JSON.stringify(decodedArgs); - const argsJson = JSON.stringify(args); - expect(decodedArgsJson).to.be.equal(argsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Duplicate Two-Dimensional Arrays', async () => { // Generate calldata @@ -235,9 +211,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => { expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata); // Validate decoding const decodedArgs = method.decode(optimizedCalldata); - const decodedArgsJson = JSON.stringify(decodedArgs); - const argsJson = JSON.stringify(args); - expect(decodedArgsJson).to.be.equal(argsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Duplicate Array, Nested within Separate Two-Dimensional Arrays', async () => { // Generate calldata @@ -252,9 +226,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => { expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata); // Validate decoding const decodedArgs = method.decode(optimizedCalldata); - const decodedArgsJson = JSON.stringify(decodedArgs); - const argsJson = JSON.stringify(args); - expect(decodedArgsJson).to.be.equal(argsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Array Elements Duplicated as Tuple Fields', async () => { // Generate calldata @@ -269,9 +241,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => { expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata); // Validate decoding const decodedArgs = method.decode(optimizedCalldata); - const decodedArgsJson = JSON.stringify(decodedArgs); - const argsJson = JSON.stringify(args); - expect(decodedArgsJson).to.be.equal(argsJson); + expect(decodedArgs).to.be.deep.equal(args); }); it('Array Elements Duplicated as Separate Parameter', async () => { // Generate calldata @@ -286,8 +256,6 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => { expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata); // Validate decoding const decodedArgs = method.decode(optimizedCalldata); - const decodedArgsJson = JSON.stringify(decodedArgs); - const argsJson = JSON.stringify(args); - expect(decodedArgsJson).to.be.equal(argsJson); + expect(decodedArgs).to.be.deep.equal(args); }); }); diff --git a/packages/utils/test/abi_encoder/return_values_test.ts b/packages/utils/test/abi_encoder/return_values_test.ts index 850cb1746..3215509f1 100644 --- a/packages/utils/test/abi_encoder/return_values_test.ts +++ b/packages/utils/test/abi_encoder/return_values_test.ts @@ -16,9 +16,7 @@ describe('ABI Encoder: Return Value Encoding/Decoding', () => { const returnValue = '0x'; const decodedReturnValue = method.decodeReturnValues(returnValue); const expectedDecodedReturnValue: any[] = []; - const decodedReturnValueJson = JSON.stringify(decodedReturnValue); - const expectedDecodedReturnValueJson = JSON.stringify(expectedDecodedReturnValue); - expect(decodedReturnValueJson).to.be.equal(expectedDecodedReturnValueJson); + expect(decodedReturnValue).to.be.deep.equal(expectedDecodedReturnValue); }); it('Single static return value', async () => { // Generate Return Value @@ -27,9 +25,7 @@ describe('ABI Encoder: Return Value Encoding/Decoding', () => { const encodedReturnValue = method.encodeReturnValues(returnValue); const decodedReturnValue = method.decodeReturnValues(encodedReturnValue); // Validate decoded return value - const decodedReturnValueJson = JSON.stringify(decodedReturnValue); - const expectedDecodedReturnValueJson = JSON.stringify(returnValue); - expect(decodedReturnValueJson).to.be.equal(expectedDecodedReturnValueJson); + expect(decodedReturnValue).to.be.deep.equal(returnValue); }); it('Multiple static return values', async () => { // Generate Return Value @@ -38,9 +34,7 @@ describe('ABI Encoder: Return Value Encoding/Decoding', () => { const encodedReturnValue = method.encodeReturnValues(returnValue); const decodedReturnValue = method.decodeReturnValues(encodedReturnValue); // Validate decoded return value - const decodedReturnValueJson = JSON.stringify(decodedReturnValue); - const expectedDecodedReturnValueJson = JSON.stringify(returnValue); - expect(decodedReturnValueJson).to.be.equal(expectedDecodedReturnValueJson); + expect(decodedReturnValue).to.be.deep.equal(returnValue); }); it('Single dynamic return value', async () => { // Generate Return Value @@ -49,9 +43,7 @@ describe('ABI Encoder: Return Value Encoding/Decoding', () => { const encodedReturnValue = method.encodeReturnValues(returnValue); const decodedReturnValue = method.decodeReturnValues(encodedReturnValue); // Validate decoded return value - const decodedReturnValueJson = JSON.stringify(decodedReturnValue); - const expectedDecodedReturnValueJson = JSON.stringify(returnValue); - expect(decodedReturnValueJson).to.be.equal(expectedDecodedReturnValueJson); + expect(decodedReturnValue).to.be.deep.equal(returnValue); }); it('Multiple dynamic return values', async () => { // Generate Return Value @@ -60,9 +52,7 @@ describe('ABI Encoder: Return Value Encoding/Decoding', () => { const encodedReturnValue = method.encodeReturnValues(returnValue); const decodedReturnValue = method.decodeReturnValues(encodedReturnValue); // Validate decoded return value - const decodedReturnValueJson = JSON.stringify(decodedReturnValue); - const expectedDecodedReturnValueJson = JSON.stringify(returnValue); - expect(decodedReturnValueJson).to.be.equal(expectedDecodedReturnValueJson); + expect(decodedReturnValue).to.be.deep.equal(returnValue); }); it('Mixed static/dynamic return values', async () => { // Generate Return Value @@ -71,8 +61,6 @@ describe('ABI Encoder: Return Value Encoding/Decoding', () => { const encodedReturnValue = method.encodeReturnValues(returnValue); const decodedReturnValue = method.decodeReturnValues(encodedReturnValue); // Validate decoded return value - const decodedReturnValueJson = JSON.stringify(decodedReturnValue); - const expectedDecodedReturnValueJson = JSON.stringify(returnValue); - expect(decodedReturnValueJson).to.be.equal(expectedDecodedReturnValueJson); + expect(decodedReturnValue).to.be.deep.equal(returnValue); }); }); -- cgit v1.2.3