Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

account.test - getTransactionsByTime: added buffer comparison to sort #5709

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ironfish/src/wallet/account/account.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2598,7 +2598,8 @@ describe('Accounts', () => {
expect(accountBTx).toHaveLength(2)

// tx1 and tx2 will have the same timestamp for accountB, so ordering should be reverse by hash
const sortedHashes = [tx1.hash(), tx2.hash()].sort().reverse()

const sortedHashes = [tx1.hash(), tx2.hash()].sort((a, b) => b.compare(a))

expect(accountBTx[0].transaction.hash()).toEqualHash(sortedHashes[0])
expect(accountBTx[1].transaction.hash()).toEqualHash(sortedHashes[1])
Expand All @@ -2616,7 +2617,7 @@ describe('Accounts', () => {
expect(accountATxChronological).toHaveLength(5)

// tx1 and tx2 will have the same timestamp for accountB, so ordering should be reverse by hash
const sortedHashesChron = [tx1.hash(), tx2.hash()].sort()
const sortedHashesChron = [tx1.hash(), tx2.hash()].sort((a, b) => a.compare(b))

expect(accountBTxChronological[0].transaction.hash()).toEqualHash(sortedHashesChron[0])
expect(accountBTxChronological[1].transaction.hash()).toEqualHash(sortedHashesChron[1])
Expand Down