From b74592bb52b0db19ad22179e6cdeb8a37dc32576 Mon Sep 17 00:00:00 2001 From: Yaroslava Polishchuk Date: Wed, 18 Dec 2024 14:48:25 +0100 Subject: [PATCH] Addressing PR comments --- .../tests/specs/speculos/nft.spec.ts | 10 ++++++++-- .../tests/specs/speculos/send.tx.spec.ts | 4 ---- .../tests/specs/speculos/swap.spec.ts | 8 +++++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/apps/ledger-live-desktop/tests/specs/speculos/nft.spec.ts b/apps/ledger-live-desktop/tests/specs/speculos/nft.spec.ts index dafc9ab48cb5..066517483219 100644 --- a/apps/ledger-live-desktop/tests/specs/speculos/nft.spec.ts +++ b/apps/ledger-live-desktop/tests/specs/speculos/nft.spec.ts @@ -9,6 +9,8 @@ import { CLI } from "tests/utils/cliUtils"; import invariant from "invariant"; test.describe("send NFT to ENS address", () => { + const originalValue = process.env.DISABLE_TRANSACTION_BROADCAST; + test.beforeAll(async () => { process.env.DISABLE_TRANSACTION_BROADCAST = "1"; }); @@ -57,8 +59,12 @@ test.describe("send NFT to ENS address", () => { }, ); - test.afterAll(async () => { - delete process.env.DISABLE_TRANSACTION_BROADCAST; + test.afterAll(() => { + if (originalValue !== undefined) { + process.env.DISABLE_TRANSACTION_BROADCAST = originalValue; + } else { + delete process.env.DISABLE_TRANSACTION_BROADCAST; + } }); }); diff --git a/apps/ledger-live-desktop/tests/specs/speculos/send.tx.spec.ts b/apps/ledger-live-desktop/tests/specs/speculos/send.tx.spec.ts index f8ddd9382cce..7f85819bf99b 100644 --- a/apps/ledger-live-desktop/tests/specs/speculos/send.tx.spec.ts +++ b/apps/ledger-live-desktop/tests/specs/speculos/send.tx.spec.ts @@ -218,10 +218,6 @@ test.describe("Send flows", () => { for (const transaction of transactionE2E) { test.describe("Send from 1 account to another", () => { - test.beforeAll(async () => { - process.env.DISABLE_TRANSACTION_BROADCAST = "0"; - }); - test.use({ userdata: "skip-onboarding", speculosApp: transaction.transaction.accountToDebit.currency.speculosApp, diff --git a/apps/ledger-live-desktop/tests/specs/speculos/swap.spec.ts b/apps/ledger-live-desktop/tests/specs/speculos/swap.spec.ts index 67a4a7bbcff2..27db96712d1c 100644 --- a/apps/ledger-live-desktop/tests/specs/speculos/swap.spec.ts +++ b/apps/ledger-live-desktop/tests/specs/speculos/swap.spec.ts @@ -182,6 +182,8 @@ const swaps = [ for (const { swap, xrayTicket } of swaps) { test.describe("Swap - Accepted (without tx broadcast)", () => { + const originalValue = process.env.DISABLE_TRANSACTION_BROADCAST; + test.beforeAll(async () => { process.env.SWAP_DISABLE_APPS_INSTALL = "true"; process.env.SWAP_API_BASE = "https://swap-stg.ledger-test.com/v5"; @@ -203,7 +205,11 @@ for (const { swap, xrayTicket } of swaps) { test.afterAll(async () => { delete process.env.SWAP_DISABLE_APPS_INSTALL; delete process.env.SWAP_API_BASE; - delete process.env.DISABLE_TRANSACTION_BROADCAST; + if (originalValue !== undefined) { + process.env.DISABLE_TRANSACTION_BROADCAST = originalValue; + } else { + delete process.env.DISABLE_TRANSACTION_BROADCAST; + } }); test.use({