-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(trustchain): many getOrCreateTrustchain with different creds fai…
…ls (#7282)
- Loading branch information
Showing
5 changed files
with
1,402 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
1,375 changes: 1,375 additions & 0 deletions
1,375
libs/trustchain/src/__tests__/sdk/membersManySelfAdd.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import json from "./membersManySelfAdd.json"; | ||
import { replayTrustchainSdkTests } from "../../test-helpers/replayTrustchainSdkTests"; | ||
import { scenario } from "../../test-scenarios/membersManySelfAdd"; | ||
replayTrustchainSdkTests(json, scenario); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { getEnv } from "@ledgerhq/live-env"; | ||
import Transport from "@ledgerhq/hw-transport"; | ||
import { getSdk } from ".."; | ||
|
||
export async function scenario(transport: Transport) { | ||
const applicationId = 16; | ||
|
||
let trustchainId; | ||
const n = 10; | ||
for (let i = 1; i < n; i++) { | ||
const name = "Member " + i; | ||
const sdk = getSdk(!!getEnv("MOCK"), { applicationId, name }); | ||
const creds = await sdk.initMemberCredentials(); | ||
const { trustchain } = await sdk.getOrCreateTrustchain(transport, creds); | ||
if (!trustchainId) trustchainId = trustchain.rootId; | ||
expect(trustchain.rootId).toBe(trustchainId); | ||
if (i === n - 1) { | ||
// cleanup | ||
await sdk.destroyTrustchain(trustchain, creds); | ||
} | ||
} | ||
} |