Skip to content

Commit

Permalink
added a simple test
Browse files Browse the repository at this point in the history
  • Loading branch information
zoeyTM committed Apr 9, 2024
1 parent 0fbd635 commit 3e0ae40
Showing 1 changed file with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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<UiState>
) {
const { text: actualText, height } = calculateBatchDisplay({
...exampleState,
batches: [batch],
...extraState,
});

assert.equal(height, expectedHeight);
Expand Down

0 comments on commit 3e0ae40

Please sign in to comment.