From 5fef3ee4275458fae66e9db1f5026d11fec8abd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A1ssio=20Marcos=20Goulart?= <3228151+CassioMG@users.noreply.github.com> Date: Wed, 13 Mar 2024 13:21:16 -0300 Subject: [PATCH] [TESTS] Fix expectation for getTokenInvocationArgs-related tests (#1178) * [TESTS] Fix expectation for getTokenInvocationArgs-related tests * Fix string coercion --- .../views/__tests__/SignTransaction.test.tsx | 29 +++++++------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/extension/src/popup/views/__tests__/SignTransaction.test.tsx b/extension/src/popup/views/__tests__/SignTransaction.test.tsx index 7ac9ace9d..3b1986ac8 100644 --- a/extension/src/popup/views/__tests__/SignTransaction.test.tsx +++ b/extension/src/popup/views/__tests__/SignTransaction.test.tsx @@ -213,21 +213,17 @@ describe("SignTransactions", () => { .getAllByTestId("OperationKeyVal") .map((node) => node.textContent); - expect(opDetails.includes(`Amount:${args?.amount.toString()}`)); expect( opDetails.includes( - `Contract ID:${Stellar.truncatedPublicKey(args?.contractId!)}`, + `Parameters${args?.from.toString()}${args?.to.toString()}${args?.amount.toString()}`, ), - ); + ).toBeTruthy(); expect( opDetails.includes( - `Destination:${Stellar.truncatedPublicKey(args?.to!)}`, + `Contract ID${Stellar.truncatedPublicKey(args?.contractId!)}`, ), - ); - expect( - opDetails.includes(`Source:${Stellar.truncatedPublicKey(args?.from!)}`), - ); - expect(opDetails.includes(`Function Name:${args?.fnName}`)); + ).toBeTruthy(); + expect(opDetails.includes(`Function Name${args?.fnName}`)).toBeTruthy(); }); it("displays mint parameters for Soroban mint operations", async () => { @@ -262,26 +258,23 @@ describe("SignTransactions", () => { ); userEvent.click(screen.getByTestId("Tab-Details")); + const args = getTokenInvocationArgs(op); const opDetails = screen .getAllByTestId("OperationKeyVal") .map((node) => node.textContent); - expect(opDetails.includes(`Amount:${args?.amount.toString()}`)); expect( opDetails.includes( - `Contract ID:${Stellar.truncatedPublicKey(args?.contractId!)}`, + `Parameters${args?.to.toString()}${args?.amount.toString()}`, ), - ); + ).toBeTruthy(); expect( opDetails.includes( - `Destination:${Stellar.truncatedPublicKey(args?.to!)}`, + `Contract ID${Stellar.truncatedPublicKey(args?.contractId!)}`, ), - ); - expect( - opDetails.includes(`Source:${Stellar.truncatedPublicKey(args?.from!)}`), - ); - expect(opDetails.includes(`Function Name:${args?.fnName}`)); + ).toBeTruthy(); + expect(opDetails.includes(`Function Name${args?.fnName}`)).toBeTruthy(); }); it("memo: doesn't render memo if there is no memo", async () => {