From 3aa1ab084a2637bb6bdec9069f37f07cd90c99e6 Mon Sep 17 00:00:00 2001 From: Hedi EDELBLOUTE Date: Wed, 23 Aug 2023 12:19:04 +0200 Subject: [PATCH] change baker whitelist integration test (#4447) --- .../families/tezos/bakers.whitelist-default.ts | 3 +-- .../families/tezos/bridge.integration.test.ts | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/libs/ledger-live-common/src/families/tezos/bakers.whitelist-default.ts b/libs/ledger-live-common/src/families/tezos/bakers.whitelist-default.ts index 699d337d9d6f..5809679d1a68 100644 --- a/libs/ledger-live-common/src/families/tezos/bakers.whitelist-default.ts +++ b/libs/ledger-live-common/src/families/tezos/bakers.whitelist-default.ts @@ -22,8 +22,7 @@ tz1V3yg82mcrPJbegqVCPn6bC8w1CSTRp3f8 tz1aRoaRhSpRYvFdyvgWLL6TGyRoGF51wDjM tz1MQJPGNMijnXnVoBENFz9rUhaPt3S7rWoz tz1dRKU4FQ9QRRQPdaH4zCR6gmCmXfcvcgtB -tz1aDiEJf9ztRrAJEXZfcG3CKimoKsGhwVAi -tz1axcnVN9tZnCe4sQQhC6f3tfSEXdjPaXPY`.split("\n"); +tz1aDiEJf9ztRrAJEXZfcG3CKimoKsGhwVAi`.split("\n"); // we give no ordering preference. it's settled at module load time whitelist.sort(() => Math.random() - 0.5); diff --git a/libs/ledger-live-common/src/families/tezos/bridge.integration.test.ts b/libs/ledger-live-common/src/families/tezos/bridge.integration.test.ts index b197b64c916a..6a88e4008018 100644 --- a/libs/ledger-live-common/src/families/tezos/bridge.integration.test.ts +++ b/libs/ledger-live-common/src/families/tezos/bridge.integration.test.ts @@ -132,11 +132,20 @@ function makeAccount(name, pubkey, address, derivationMode) { testBridge(dataset); describe("tezos bakers", () => { - // FIXME Flaky test that will fail every time a Tezos baker is discontinued - test("getting the bakers", async () => { - const list = await listBakers(whitelist); - expect(list.map(o => o.address)).toEqual(whitelist); + test("atleast 10 whitelisted bakers are online", async () => { + const bakers = await listBakers(whitelist); + const retrievedAddresses = bakers.map(o => o.address); + let available = 0; + for (const whitelisted of whitelist) { + if (retrievedAddresses.includes(whitelisted)) { + available++; + } else { + console.warn(`Baker ${whitelisted} no longer online !`); + } + } + expect(available).toBeGreaterThan(10); }); + // TODO we'll need two accounts to test diff cases test("load account baker info", async () => { const account = fromAccountRaw(accountTZrevealedDelegating);