Skip to content

Commit 91e911a

Browse files
jacobshirleyclaude
andcommitted
fix: await demonstrateUsage() to make example output deterministic
The doubled fire-and-forget calls caused non-deterministic interleaved output that differed between node and browser environments. Single awaited call produces consistent output in both. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 8fe40f3 commit 91e911a

2 files changed

Lines changed: 1 addition & 20 deletions

File tree

packages/pki-lite-crypto-extended/examples/usage.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,4 @@ async function demonstrateUsage() {
9898
)
9999
}
100100

101-
// Execute the demonstration
102-
demonstrateUsage().catch(console.error)
103-
104-
// Run the demonstration
105-
demonstrateUsage().catch(console.error)
101+
await demonstrateUsage()

packages/pki-lite-crypto-extended/test/acceptance/__snapshots__/examples.spec.ts.snap

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,9 @@
22

33
exports[`Examples > usage 1`] = `
44
"=== MD5 Hashing ===
5-
=== MD5 Hashing ===
65
MD5: 65a8e27d8879283831b664bd8b7f0ad4
76
87
=== AES ECB Encryption ===
9-
MD5: 65a8e27d8879283831b664bd8b7f0ad4
10-
11-
=== AES ECB Encryption ===
12-
Original: Secret message!!
13-
Decrypted: Secret message!!
14-
Match: true
15-
16-
=== AES CBC (No Padding) ===
178
Original: Secret message!!
189
Decrypted: Secret message!!
1910
Match: true
@@ -24,12 +15,6 @@ Decrypted length: 16
2415
Data match: true
2516
2617
=== Standard Algorithms (Fallback) ===
27-
Original length: 16
28-
Decrypted length: 16
29-
Data match: true
30-
31-
=== Standard Algorithms (Fallback) ===
32-
SHA-256: dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f
3318
SHA-256: dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f
3419
"
3520
`;

0 commit comments

Comments
 (0)