-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eeb956a
commit abd673d
Showing
3 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@ledgerhq/coin-polkadot": minor | ||
--- | ||
|
||
Update lockedbalance retrieval polkadot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import BigNumber from "bignumber.js"; | ||
import { getAccount } from "./sidecar"; | ||
|
||
const networkApiMock = jest.fn(); | ||
|
||
describe("getAccount", () => { | ||
it("should estimate lockedBalance correctly with 1 locked balance type", async () => { | ||
const lockedBalanceFn = getAccount(networkApiMock, jest.fn()); | ||
networkApiMock.mockResolvedValue({ | ||
data: { | ||
locks: [ | ||
{ | ||
amount: "60000000000", | ||
reasons: "All", | ||
}, | ||
], | ||
targets: [], | ||
}, | ||
}); | ||
const { lockedBalance } = await lockedBalanceFn("addr"); | ||
expect(lockedBalance).toEqual(new BigNumber("60000000000")); | ||
}); | ||
|
||
it("should estimate lockedBalance when one locked balance is higher than others", async () => { | ||
const lockedBalanceFn = getAccount(networkApiMock, jest.fn()); | ||
networkApiMock.mockResolvedValue({ | ||
data: { | ||
locks: [ | ||
{ | ||
amount: "1", | ||
reasons: "reason 1", | ||
}, | ||
{ | ||
amount: "5", | ||
reasons: "reason 2", | ||
}, | ||
{ | ||
amount: "3", | ||
reasons: "reason 3", | ||
}, | ||
], | ||
targets: [], | ||
}, | ||
}); | ||
const { lockedBalance } = await lockedBalanceFn("addr"); | ||
expect(lockedBalance).toEqual(new BigNumber("5")); | ||
}); | ||
}); |
abd673d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
live-common-tools – ./
ledger-live-tools.vercel.app
live-common-tools-ledgerhq.vercel.app
live-common-tools-git-develop-ledgerhq.vercel.app
ledger-live.vercel.app
live.ledger.tools