Skip to content

Commit

Permalink
chore: try to fix pnpm-lock
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Prohaszka <stephane.prohaszka@ledger.fr>
  • Loading branch information
sprohaszka-ledger committed May 16, 2024
1 parent 66e571a commit 7e086fc
Show file tree
Hide file tree
Showing 2 changed files with 2,163 additions and 11,985 deletions.
72 changes: 72 additions & 0 deletions libs/coin-modules/coin-tezos/src/bridge/prepareTransaction.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import BigNumber from "bignumber.js";
import { createFixtureAccount, createFixtureTransaction } from "../types/model.fixture";
import { Transaction } from "../types";
import prepareTransaction from "./prepareTransaction";

describe("prepareTransaction", () => {
it("returns same transaction when account balance is 0", async () => {
// Given
const account = createFixtureAccount({ balance: BigNumber("0") });
const transaction = createFixtureTransaction();

// When
const result = await prepareTransaction(account, transaction);

// Then
expect(result).toBe(transaction);
});

it("returns a transaction with an error when input tx has 0 amount", async () => {
// Given
const account = createFixtureAccount({ balance: BigNumber("1200") });
const transaction = createFixtureTransaction({ amount: BigNumber("0") });

// When
const result = await prepareTransaction(account, transaction);

// Then
const expectedResult: Transaction = {
amount: BigNumber("0"),
recipient: "tz1VJitLYB31fEC82efFkLRU4AQUH9QgH3q6",
family: "tezos",
mode: "send",
estimatedFees: undefined,
fees: undefined,
gasLimit: undefined,
networkInfo: undefined,
storageLimit: undefined,
taquitoError: "proto.018-Proxford.contract.empty_transaction",
};
expect(result).toEqual(expectedResult);
});

it.skip("returns new transaction", async () => {
// Given
const account = createFixtureAccount({
freshAddress: "tz1RoqRN77gGpeV96vEXzt62Sns2LViZiUCa",
xpub: "6564706b7647704d6d387246517838655a376a61714b346a735771506879326a366e32394e756d485a315a3774597139664758583947",
balance: BigNumber("1200"),
});
const transaction = createFixtureTransaction({ amount: BigNumber("12") });

// When
const result = await prepareTransaction(account, transaction);

// Then
const expectedResult: Transaction = {
amount: BigNumber("0"),
recipient: "tz1VJitLYB31fEC82efFkLRU4AQUH9QgH3q6",
family: "tezos",
mode: "send",
estimatedFees: undefined,
fees: undefined,
gasLimit: undefined,
networkInfo: undefined,
storageLimit: undefined,
taquitoError: undefined,
};
expect(result).toEqual(expectedResult);
expect(result).not.toBe(transaction);
expect(result).toBe(expectedResult);
});
});

0 comments on commit 7e086fc

Please sign in to comment.