Skip to content

Commit

Permalink
[TESTS] Fix expectation for getTokenInvocationArgs-related tests (#1178)
Browse files Browse the repository at this point in the history
* [TESTS] Fix expectation for getTokenInvocationArgs-related tests

* Fix string coercion
  • Loading branch information
CassioMG authored Mar 13, 2024
1 parent fec00aa commit 5fef3ee
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions extension/src/popup/views/__tests__/SignTransaction.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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 () => {
Expand Down

0 comments on commit 5fef3ee

Please sign in to comment.