Skip to content

Commit

Permalink
improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jprudent committed Jan 31, 2025
1 parent 685f1d1 commit abdf44c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions libs/coin-modules/coin-xrp/src/api/index.integ.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ describe("Xrp Api", () => {
recipient: "rKRtUG15iBsCQRgrkeUEg5oX4Ae2zWZ89z",
amount: BigInt(10),
fee: BigInt(1),
memos: [{ data: "01", format: "02", type: "03" }],
destinationTag: 123,
});

// Then
Expand Down
12 changes: 10 additions & 2 deletions libs/coin-modules/coin-xrp/src/logic/craftTransaction.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { craftTransaction } from "./craftTransaction";

import { decode } from "ripple-binary-codec";
jest.mock("../network", () => ({
getLedgerIndex: () => 1,
}));
Expand Down Expand Up @@ -46,6 +46,8 @@ describe("craftTransaction", () => {
recipient: "rJe1St1G6BWMFmdrrcT7NdD3XT1NxTMEWN",
amount: BigInt(100_000_000),
fee: BigInt(100),
memos: [{ data: "01", format: "02", type: "03" }],
destinationTag: 123,
};
const pubKey = "public_key";

Expand All @@ -59,12 +61,18 @@ describe("craftTransaction", () => {
Account: "rPDf6SQStnNmw1knCu1ei7h6BcDAEUUqn5",
Amount: "100000000",
Destination: "rJe1St1G6BWMFmdrrcT7NdD3XT1NxTMEWN",
DestinationTag: undefined,
DestinationTag: 123,
Fee: "100",
Flags: 2147483648,
Sequence: 2,
LastLedgerSequence: 21,
Memos: [{ Memo: { MemoData: "01", MemoFormat: "02", MemoType: "03" } }],
});
expect(result.serializedTransaction).toBeDefined();
const binDecodedTx = decode(result.serializedTransaction);
expect(binDecodedTx.Memos).toEqual([
{ Memo: { MemoData: "01", MemoFormat: "02", MemoType: "03" } },
]);
expect(binDecodedTx.DestinationTag).toEqual(123);
});
});

0 comments on commit abdf44c

Please sign in to comment.