Skip to content

Commit

Permalink
fix: add retry for getLastConnectedWallet test
Browse files Browse the repository at this point in the history
  • Loading branch information
delivan committed Oct 15, 2024
1 parent 9c59bdb commit 037073a
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions packages/core/src/__test__/storage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,25 @@ describe("getLastConnectedWallet()", () => {
const lastConnectedWallet = await sn.getLastConnectedWallet()
expect(lastConnectedWallet?.id).toBe(BraavosMock.id)
})
it("should set the last connected wallet when enabled", async () => {
const sn = getWallet({
"starknet-argentX": makeConnected(true)(ArgentXMock),
"starknet-braavos": makeConnected(true)(BraavosMock),
starknet_okxwallet: makeConnected(true)(OKXMock),
starknet_keplr: makePreAuthorized(true)(KeplrMock),
})
const lastConnectedWallet = await sn.getLastConnectedWallet()
expect(lastConnectedWallet).toBe(null)
it(
"should set the last connected wallet when enabled",
{ retry: 5 },
async () => {
const sn = getWallet({
"starknet-argentX": makeConnected(true)(ArgentXMock),
"starknet-braavos": makeConnected(true)(BraavosMock),
starknet_okxwallet: makeConnected(true)(OKXMock),
starknet_keplr: makePreAuthorized(true)(KeplrMock),
})
const lastConnectedWallet = await sn.getLastConnectedWallet()
expect(lastConnectedWallet).toBe(null)

const [newLastConnectedWallet] = await sn.getAvailableWallets()
await sn.enable(newLastConnectedWallet)
const lastConnectedWalletAfterEnable = await sn.getLastConnectedWallet()
expect(lastConnectedWalletAfterEnable).toBe(newLastConnectedWallet)
})
const [newLastConnectedWallet] = await sn.getAvailableWallets()
await sn.enable(newLastConnectedWallet)
const lastConnectedWalletAfterEnable = await sn.getLastConnectedWallet()
expect(lastConnectedWalletAfterEnable).toBe(newLastConnectedWallet)
},
)
it("enabling fails", async () => {
const sn = getWallet({
"starknet-argentX": makeConnected(false)(ArgentXMock),
Expand Down

0 comments on commit 037073a

Please sign in to comment.