Skip to content

Commit

Permalink
Test fix proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
may01 committed Jan 7, 2025
1 parent 71697b7 commit 76cbd9c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions libs/ledger-live-common/src/families/aptos/LedgerAccount.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,21 @@ describe("LedgerAccount Test", () => {

it("Testing signTransaction method", async () => {
const api = new AptosAPI("aptos");
const ledger_account = new LedgerAccount(Account.APTOS_1.address);
const account = createFixtureAccount();
const ledger_account = new LedgerAccount(account.freshAddressPath);
const transport = {} as Transport;
const mockSignTransaction = jest.fn().mockResolvedValue({
signature: Buffer.from("signature"),
signature: Buffer.from("0x13321ab5d9da6ea27ff47a89f55bb384f0cc0b04a755d5098fc5e0653179a1"), // random hex to fulfill expectation of 64 length
});
HwAptos.prototype.signTransaction = mockSignTransaction;

const mockGetAddress = jest.fn().mockResolvedValue({
address: account.freshAddress,
publicKey: Buffer.from("0x13321ab5d9da6ea27ff47a89f55bb8"), // random hex to fulfill expectations of 32 length
chainCode: Buffer.from(""),
});
HwAptos.prototype.getAddress = mockGetAddress;

await ledger_account.init(transport);
const payload = {
function: "0x1::aptos_account::transfer_coins",
Expand All @@ -85,7 +93,7 @@ describe("LedgerAccount Test", () => {
expirationTimestampSecs: "1735639799486",
};

const rawTxn = await api.generateTransaction(Account.APTOS_1.address, payload, options);
const rawTxn = await api.generateTransaction(account.freshAddress, payload, options);
const signedTxn = await ledger_account.signTransaction(rawTxn);

expect(signedTxn).toBeInstanceOf(Uint8Array);
Expand Down

0 comments on commit 76cbd9c

Please sign in to comment.