diff --git a/tests/unit/utils/analyzer/FunctionCallAnalyzer.spec.ts b/tests/unit/utils/analyzer/FunctionCallAnalyzer.spec.ts index e4d6a3ab5..84e43fc87 100644 --- a/tests/unit/utils/analyzer/FunctionCallAnalyzer.spec.ts +++ b/tests/unit/utils/analyzer/FunctionCallAnalyzer.spec.ts @@ -50,6 +50,7 @@ describe("FunctionCallAnalyzer.spec.ts", () => { expect(functionCallAnalyzer.errorSignature.value).toBeNull() expect(functionCallAnalyzer.errorInputs.value).toStrictEqual([]) expect(functionCallAnalyzer.inputDecodingStatus.value).toBeNull() + expect(functionCallAnalyzer.outputDecodingStatus.value).toBeNull() expect(functionCallAnalyzer.errorDecodingStatus.value).toBeNull() // 2) mount @@ -63,6 +64,7 @@ describe("FunctionCallAnalyzer.spec.ts", () => { expect(functionCallAnalyzer.errorSignature.value).toBeNull() expect(functionCallAnalyzer.errorInputs.value).toStrictEqual([]) expect(functionCallAnalyzer.inputDecodingStatus.value).toBeNull() + expect(functionCallAnalyzer.outputDecodingStatus.value).toBeNull() expect(functionCallAnalyzer.errorDecodingStatus.value).toBeNull() // 3) input setup (valid encoding) @@ -83,9 +85,10 @@ describe("FunctionCallAnalyzer.spec.ts", () => { expect(functionCallAnalyzer.errorSignature.value).toBeNull() expect(functionCallAnalyzer.errorInputs.value).toStrictEqual([]) expect(functionCallAnalyzer.inputDecodingStatus.value).toBeNull() + expect(functionCallAnalyzer.outputDecodingStatus.value).toBeNull() expect(functionCallAnalyzer.errorDecodingStatus.value).toBeNull() - // 4) input setup (invalid encoding) + // 4) input setup (invalid input encoding) input.value = "0x618dc65e0000000000000000000000000000000000163b5a70a082310000000000000000000000005fe56763c7633efefe8c2272f19732521a48e300" output.value = "0x00000000000000000000000000000000000000000000000000003dc604b33217" contractId.value = "0.0.359" @@ -98,10 +101,30 @@ describe("FunctionCallAnalyzer.spec.ts", () => { expect(functionCallAnalyzer.errorSignature.value).toBeNull() expect(functionCallAnalyzer.errorInputs.value).toStrictEqual([]) expect(functionCallAnalyzer.inputDecodingStatus.value).toBe("Decoding Error (data out-of-bounds)") + expect(functionCallAnalyzer.outputDecodingStatus.value).toBe("Decoding Error (data out-of-bounds)") + expect(functionCallAnalyzer.errorDecodingStatus.value).toBeNull() + + // 5) output setup (invalid output encoding) + input.value = "0x49146bde000000000000000000000000845b706151aed537b1fd81c1ea4ea03920097abd0000000000000000000000000000000000000000000000000000000002e6ae09" + output.value = "0x000000009999999999999999999999999" + contractId.value = "0.0.359" + await flushPromises() + expect(functionCallAnalyzer.functionHash.value).toBe("0x49146bde") + expect(functionCallAnalyzer.signature.value).toBe("associateToken(address,address)") + expect(functionCallAnalyzer.inputs.value).toStrictEqual([ + new NameTypeValue("account", "address", "0x845b706151aEd537b1FD81c1Ea4EA03920097ABD"), + new NameTypeValue("token", "address", "0x0000000000000000000000000000000002E6Ae09"), + ]) + expect(functionCallAnalyzer.outputs.value).toStrictEqual([]) + expect(functionCallAnalyzer.errorHash.value).toBeNull() + expect(functionCallAnalyzer.errorSignature.value).toBeNull() + expect(functionCallAnalyzer.errorInputs.value).toStrictEqual([]) + expect(functionCallAnalyzer.inputDecodingStatus.value).toBeNull() + expect(functionCallAnalyzer.outputDecodingStatus.value).toBe("Decoding Error (hex data is odd-length)") expect(functionCallAnalyzer.errorDecodingStatus.value).toBeNull() - // 5) unmount + // 6) unmount functionCallAnalyzer.unmount() await flushPromises() expect(functionCallAnalyzer.functionHash.value).toBeNull() @@ -112,6 +135,7 @@ describe("FunctionCallAnalyzer.spec.ts", () => { expect(functionCallAnalyzer.errorSignature.value).toBeNull() expect(functionCallAnalyzer.errorInputs.value).toStrictEqual([]) expect(functionCallAnalyzer.inputDecodingStatus.value).toBeNull() + expect(functionCallAnalyzer.outputDecodingStatus.value).toBeNull() expect(functionCallAnalyzer.errorDecodingStatus.value).toBeNull() })