Skip to content

Commit

Permalink
refactor: cleanup TODO and magic numbers in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
erictaylor committed Sep 27, 2024
1 parent ddefe8c commit 9e57a3b
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/vms/pvm/etna-builder/builder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,12 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
});

test('newImportTx', () => {
const utxos = testUtxos();
const VALID_AMOUNT = BigInt(50 * 1e9);
const utxos = [
getLockedUTXO(),
getNotTransferOutput(),
getValidUtxo(new BigIntPr(VALID_AMOUNT)),
];

const unsignedTx = newImportTx(
{
Expand Down Expand Up @@ -271,8 +276,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
[
TransferableOutput.fromNative(
testContext.avaxAssetID,
// TODO: How to remove this "magic" number. How do we calculate it correctly from utxos?
50_000_000_000n - expectedFee,
VALID_AMOUNT - expectedFee,
[testAddress1],
),
],
Expand All @@ -287,10 +291,16 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
});

test('newExportTx', () => {
const utxos = testUtxos();
const VALID_AMOUNT = BigInt(50 * 1e9);
const OUT_AMOUNT = BigInt(5 * 1e9);
const utxos = [
getLockedUTXO(),
getNotTransferOutput(),
getValidUtxo(new BigIntPr(VALID_AMOUNT)),
];
const tnsOut = TransferableOutput.fromNative(
testContext.avaxAssetID,
BigInt(5 * 1e9),
OUT_AMOUNT,
[toAddress],
);

Expand Down Expand Up @@ -329,8 +339,7 @@ describe('./src/vms/pvm/etna-builder/builder.test.ts', () => {
[
TransferableOutput.fromNative(
testContext.avaxAssetID,
// TODO: Remove magic number. How to calculate it correctly from utxos?
45_000_000_000n - expectedFee,
VALID_AMOUNT - OUT_AMOUNT - expectedFee,
fromAddressesBytes,
),
],
Expand Down

0 comments on commit 9e57a3b

Please sign in to comment.