Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vsubhuman committed Dec 12, 2024
1 parent 2ac1e2e commit a657984
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 27 deletions.
8 changes: 4 additions & 4 deletions packages/yoroi-extension/app/api/ada/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ describe('app/api/ada/index', () => {
{
identifier: '',
networkId: 300,
amount: new BigNumber('8812631')
amount: new BigNumber('8812367')
},
{
amount: new BigNumber('45000000'),
Expand All @@ -508,7 +508,7 @@ describe('app/api/ada/index', () => {
]
);

expect(response.unsignedTx.get_fee_if_set()?.to_str()).toEqual('187369');
expect(response.unsignedTx.get_fee_if_set()?.to_str()).toEqual('187633');

function cmpOutputs(o1: any, o2: any): number {
if (o1.address > o2.address) {
Expand All @@ -530,7 +530,7 @@ describe('app/api/ada/index', () => {
collateral_return: null,
current_treasury_value: null,
donation: null,
fee: '187369',
fee: '187633',
inputs: [
{
index: 1,
Expand Down Expand Up @@ -610,7 +610,7 @@ describe('app/api/ada/index', () => {
{
address: 'addr_test1qp00295qtc07m8f65trccaveaycum8zaj9xrwt4jw2qqdn7r3y3kdut55a40jff00qmg74686vz44v6k363md06qkq0qn97ahn',
amount: {
coin: '2657551',
coin: '2657287',
multiasset: null
},
plutus_data: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ test('Create Ledger transaction', async () => {

expect(response).toStrictEqual(({
options: {
tagCborSets: false,
tagCborSets: true,
},
signingMode: TransactionSigningMode.ORDINARY_TRANSACTION,
tx: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,23 +405,23 @@ describe('Create unsigned TX from UTXO', () => {

await testTxConstruction([0.2, 0.2, 0.2, 0.2, 0.2], {
inputs: [utxos[3]],
fee: '1330',
fee: '1342',
sumInputs: '30000000',
sumOutputs: '29998670',
sumOutputs: '29998658',
});

await testTxConstruction([0.7, 0.7, 0.7, 0.7, 0.7], {
inputs: [utxos[2]],
fee: '1402',
fee: '1414',
sumInputs: '10000001',
sumOutputs: '9998599',
sumOutputs: '9998587',
});

await testTxConstruction([0.7, 0.2, 0.7, 0.2, 0.7], {
inputs: [utxos[2]],
fee: '1402',
fee: '1414',
sumInputs: '10000001',
sumOutputs: '9998599',
sumOutputs: '9998587',
});
});

Expand Down Expand Up @@ -466,13 +466,13 @@ describe('Create unsigned TX from UTXO', () => {
try {
expect(new Set([utxos[4], utxos[2]])).toEqual(new Set(unsignedTxResponse.senderUtxos));
expect(unsignedTxResponse.txBuilder.get_explicit_input().coin().to_str()).toEqual('12000002');
expect(unsignedTxResponse.txBuilder.get_explicit_output().coin().to_str()).toEqual('11998054');
expect(unsignedTxResponse.txBuilder.min_fee().to_str()).toEqual('1948');
expect(unsignedTxResponse.txBuilder.get_explicit_output().coin().to_str()).toEqual('11998036');
expect(unsignedTxResponse.txBuilder.min_fee().to_str()).toEqual('1966');
} catch {
expect(new Set([utxos[4], utxos[3]])).toEqual(new Set(unsignedTxResponse.senderUtxos));
expect(unsignedTxResponse.txBuilder.get_explicit_input().coin().to_str()).toEqual('32000001');
expect(unsignedTxResponse.txBuilder.get_explicit_output().coin().to_str()).toEqual('31998331');
expect(unsignedTxResponse.txBuilder.min_fee().to_str()).toEqual('1670');
expect(unsignedTxResponse.txBuilder.get_explicit_output().coin().to_str()).toEqual('31998319');
expect(unsignedTxResponse.txBuilder.min_fee().to_str()).toEqual('1682');
}

function assertMultiAsset(masset: any, policy: string, name: string, amount: string): void {
Expand Down Expand Up @@ -711,7 +711,7 @@ describe('Create unsigned TX from UTXO', () => {
);

expect(result.senderUtxos.length).toEqual(2);
expect(result.txBuilder.get_fee_if_set()?.to_str()).toEqual('1172');
expect(result.txBuilder.get_fee_if_set()?.to_str()).toEqual('1184');
});
});

Expand Down Expand Up @@ -750,7 +750,7 @@ describe('Create unsigned TX from addresses', () => {

expect(unsignedTxResponse.txBuilder.get_explicit_input().coin().to_str()).toEqual('1000001');
expect(unsignedTxResponse.txBuilder.get_explicit_output().coin().to_str()).toEqual('5001');
expect(unsignedTxResponse.txBuilder.min_fee().to_str()).toEqual('994');
expect(unsignedTxResponse.txBuilder.min_fee().to_str()).toEqual('1006');
// burns remaining amount
expect(
unsignedTxResponse.txBuilder.get_explicit_input().checked_sub(
Expand Down Expand Up @@ -818,7 +818,7 @@ describe('Create signed transactions', () => {
expect(bootstrapWits.len()).toEqual(1);

expect(bootstrapWits.get(0).to_hex()).toEqual(
'8458208fb03c3aa052f51c086c54bd4059ead2d2e426ac89fa4b3ce41cbfd8800b51c0584029239c4ecf5123beb4256558be536c2745595a9be9348cede7e71138c03aaed70acdc6847165e51843e5e30d6a4bc96d3f68191d1ee35d04e5dfc0df0fd4ed0858202623fceb96b07408531a5cb259f53845a38d6b68928e7c0c7e390f07545d0e6241a0'
'8458208fb03c3aa052f51c086c54bd4059ead2d2e426ac89fa4b3ce41cbfd8800b51c058401413c6476e6faf85a43616d936e595038e704d88e3bb845c18a65b3dc8aca436ac4f671e9ef785b170d1e16bff704f00ac274144222a26a2850a201ac81b5d0b58202623fceb96b07408531a5cb259f53845a38d6b68928e7c0c7e390f07545d0e6241a0'
);
});

Expand Down Expand Up @@ -895,7 +895,7 @@ describe('Create signed transactions', () => {
expect(bootstrapWits.len()).toEqual(1); // note: only one witness since we got rid of duplicates

expect(bootstrapWits.get(0).to_hex()).toEqual(
'8458208fb03c3aa052f51c086c54bd4059ead2d2e426ac89fa4b3ce41cbfd8800b51c058401edebb108c74a991bef5b28458778fc0713499349d77fb98acc63e4219cfcd1b51321ccaccdf2ce2e80d7c2687f3d79feea32daedcfbc19792dff0358af5950358202623fceb96b07408531a5cb259f53845a38d6b68928e7c0c7e390f07545d0e6241a0'
'8458208fb03c3aa052f51c086c54bd4059ead2d2e426ac89fa4b3ce41cbfd8800b51c05840593e3d54a9bf9b5e6778ddb8930bdd9a87dd29f046fa3ba9d49bd1b7ddecdb6a1ced6016cdab663ff21596380392786d67f70e8d7c200fc042d669981db11c0658202623fceb96b07408531a5cb259f53845a38d6b68928e7c0c7e390f07545d0e6241a0'
);
});

Expand Down Expand Up @@ -977,8 +977,8 @@ describe('Create signed transactions', () => {
].sort();

expect(witArray).toEqual([
'82582001c01f8b958699ae769a246e9785db5a70e023977ea4b856dfacf23c23346caf58401b10a18433be709391e70a82c4de91d1c8b3cb27dfa7c7d19a247a4dfe5dea437a0ebefe3ced5f6f7ad2bc79b11c5556614f8bec19b87fc5145a13edc3ae320f',
'82582038c14a0756e1743081a8ebfdb9169b11283a7bf6c38045c4c4a5e62a7689639d58403a56ed05738ec98589a1263281bfd33ec5f0bed3f90eafced8ed8652be65f3327487cb487dde0d26ca9a7ce568a4c05367630baec47a5d771ba7b184161b100d',
'82582001c01f8b958699ae769a246e9785db5a70e023977ea4b856dfacf23c23346caf584082e3f8c75693dccdabcbfbef96568955188fcd9a3002f4352129f2a1388b2c75e99d5195d1d2dcdb95d50c249f576e312bd970476428a02c7d9d20e7b211c302',
'82582038c14a0756e1743081a8ebfdb9169b11283a7bf6c38045c4c4a5e62a7689639d584030c1bcbb6f5e3e72a08c5f9342efb7cc5de84fd5c4884536fcade04d280779c5a90271b16ef20eb7f13b457c8db251281f782ccb558a658f579eda6e1cff460b',
]);
});

Expand Down Expand Up @@ -1048,7 +1048,7 @@ describe('Create signed transactions', () => {
const txBody = unsignedTxResponse.txBuilder.build();
expect(txBody.withdrawals()?.len()).toEqual(1);
const fee = txBody.fee().to_str();
expect(fee).toEqual('1954');
expect(fee).toEqual('1972');
expect(txBody.outputs().len()).toEqual(6);
expect(txBody.outputs().get(5).amount().coin().to_str()).toEqual(
new BigNumber(addressedUtxos[3].amount)
Expand All @@ -1066,8 +1066,8 @@ describe('Create signed transactions', () => {
].sort();

expect(witArray).toEqual([
'82582001c01f8b958699ae769a246e9785db5a70e023977ea4b856dfacf23c23346caf5840911fd2f8eb6ffe345ea08dbb76ad699eb663c01bd099c4e28f9cae130d7381aad40be3c3e883872f2219b5bdf720b8bffccdbb56ca3b4394b70601b8fe2e5f0d',
'82582038c14a0756e1743081a8ebfdb9169b11283a7bf6c38045c4c4a5e62a7689639d5840faab139b4304f17b7c93178a7cbda40a7cc9dbd6d7883a90f3ce4f817fab070349a9ed3e7a5e578e92a00f80acf43c6e847e4de2bd4dff270997bbc835da9502',
'82582001c01f8b958699ae769a246e9785db5a70e023977ea4b856dfacf23c23346caf5840b84f78dabde17e36fbf2fdf683c6aae459288325afb1cd6873e971c408d991c9e8dfcd742c62773276edfb32f40100e50f6949d8f13e34f10bc58354fad3fe0c',
'82582038c14a0756e1743081a8ebfdb9169b11283a7bf6c38045c4c4a5e62a7689639d5840eba05e14f29629cd90ea8cf0553462714227001c4e0470f278ea84afe3ecedcae4cd5d3fdc73b058991ed79a36829c4889827f2ba43ae6ace6019b8064e8bd0c',
]);
});
});
Expand Down Expand Up @@ -1097,7 +1097,7 @@ describe('Create sendAll unsigned TX from UTXO', () => {
network.NetworkId,
);

const expectedFee = new BigNumber('1344');
const expectedFee = new BigNumber('1356');
const expectedInput = new BigNumber('11000002');
expect(sendAllResponse.senderUtxos).toEqual([utxos[0], utxos[1]]);
expect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,5 +273,6 @@ test('Create Trezor transaction', async () => {
type: CardanoCertificateType.STAKE_REGISTRATION,
}],
signingMode: 0,
tagCborSets: true,
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe('Haskell Shelley era tx format tests', () => {
protocolParams: getProtocolParams(),
});

const expectedFee = new BigNumber('166337');
const expectedFee = new BigNumber('166601');
expect(transferInfo.fee.getDefault().toString()).toBe(expectedFee.toString());
expect(transferInfo.recoveredBalance.getDefault().toString()).toBe(inputAmount.toString());
expect(transferInfo.senders).toEqual([addr1.address]);
Expand All @@ -155,6 +155,6 @@ describe('Haskell Shelley era tx format tests', () => {
if (witnesses == null) throw new Error('no bootstrap witnesses found');
expect(witnesses.len()).toBe(1);
expect(witnesses.get(0).to_hex())
.toBe('84582007cc5b01ab460562479f3e7fdf782b11636c4a1b721c19b9c1609bc7360b518e584019d98b819060294910b7669d0e7e4b6c8843f9524626ff53b028ac9d38f415eb389141bad0589f858133423a07b13245af641f152bf4b06287171315676ae2045820f3748736afd541361c4fb90b2963723fe9a10d237a024530d378181df4bf2c6841a0');
.toBe('84582007cc5b01ab460562479f3e7fdf782b11636c4a1b721c19b9c1609bc7360b518e5840dfa4a46f92326070f09781cdf2c6e319f8b1b3cc425a257c655ebcfe4445def365c1e888f2b78cdf268586848999ca2ae093d4a9f9bf7667f7e11b2f141bae0d5820f3748736afd541361c4fb90b2963723fe9a10d237a024530d378181df4bf2c6841a0');
});
});

0 comments on commit a657984

Please sign in to comment.