Skip to content

Commit

Permalink
add extra logging
Browse files Browse the repository at this point in the history
  • Loading branch information
gc committed Feb 25, 2024
1 parent 39cc40c commit c81080f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/lib/grandExchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ ${type} ${toKMB(quantity)} ${item.name} for ${toKMB(price)} each, for a total of
buyerLoot.add('Coins', buyerRefund);
bankToRemoveFromGeBank.add('Coins', buyerRefund);

debugLog(
console.log(
`Buyer got refunded ${buyerRefund} GP due to price difference. Buyer was asking ${buyerListing.asking_price_per_item}GP for each of the ${quantityToBuy}x items, seller was asking ${sellerListing.asking_price_per_item}GP, and the post-tax price per item was ${pricePerItemAfterTax}`,
logContext
);
Expand Down Expand Up @@ -528,8 +528,8 @@ ${type} ${toKMB(quantity)} ${item.name} for ${toKMB(price)} each, for a total of
throw new Error(str);
}

debugLog(
`Completing a transaction, removing ${bankToRemoveFromGeBank} from the GE bank, ${totalTaxPaid} in taxed gp. The current GE bank is ${geBank.toString()}.`,
console.log(
`Completing a transaction, removing ${bankToRemoveFromGeBank} from the GE bank, ${totalTaxPaid} in taxed gp. The current GE bank is ${geBank.toString()}. ${debug}`,
{
totalPriceAfterTax,
totalTaxPaid,
Expand Down Expand Up @@ -589,7 +589,7 @@ ${type} ${toKMB(quantity)} ${item.name} for ${toKMB(price)} each, for a total of
...makeTransactFromTableBankQueries({ bankToRemove: bankToRemoveFromGeBank })
]);

debugLog(`Transaction completed, the new G.E bank is ${await this.fetchOwnedBank()}.`);
console.log(`Transaction completed, the new G.E bank is ${await this.fetchOwnedBank()}.`);

const buyerUser = await mUserFetch(buyerListing.user_id);
const sellerUser = await mUserFetch(sellerListing.user_id);
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/grandExchange.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ describe('Grand Exchange', async () => {
}
await commandPromises.onEmpty();
await waitForGEToBeEmpty();

console.log('Finished running all commands');

// Tick the g.e to make some transactions
Expand Down Expand Up @@ -176,6 +175,8 @@ Based on G.E data, we should have received ${data.totalTax} tax`;

await GrandExchange.queue.onEmpty();
assert(GrandExchange.queue.size === 0, 'Queue should be empty');
const geBank = await GrandExchange.fetchOwnedBank();
console.log('Finished G.E tests, final bank: ', geBank);
},
{
repeats: 1,
Expand Down

0 comments on commit c81080f

Please sign in to comment.