From 3e0ae404bda6d5e750e63ca3fdd744b22321d7d0 Mon Sep 17 00:00:00 2001 From: zoeyTM Date: Tue, 9 Apr 2024 01:10:14 -0400 Subject: [PATCH] added a simple test --- .../ui/helpers/calculate-batch-display.ts | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/packages/hardhat-plugin/test/ui/helpers/calculate-batch-display.ts b/packages/hardhat-plugin/test/ui/helpers/calculate-batch-display.ts index b6d137b08..f77aa8a1f 100644 --- a/packages/hardhat-plugin/test/ui/helpers/calculate-batch-display.ts +++ b/packages/hardhat-plugin/test/ui/helpers/calculate-batch-display.ts @@ -182,16 +182,44 @@ describe("ui - calculate batch display", () => { expectedText ); }); + + it("should render a batch when using a ledger device", () => { + const expectedText = testFormat(` + Batch #1 + Executing ExampleModule#Token... + + Ledger: Waiting for confirmation on device + `); + + assertBatchText( + [ + { + status: { + type: UiFutureStatusType.UNSTARTED, + }, + futureId: "ExampleModule#Token", + }, + ], + 3, + expectedText, + { + ledger: true, + ledgerMessage: "Waiting for confirmation on device", + } + ); + }); }); function assertBatchText( batch: UiFuture[], expectedHeight: number, - expectedText: string + expectedText: string, + extraState?: Partial ) { const { text: actualText, height } = calculateBatchDisplay({ ...exampleState, batches: [batch], + ...extraState, }); assert.equal(height, expectedHeight);