aboutsummaryrefslogtreecommitdiff
path: root/integration/bunjs-only-snippets/crypto.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'integration/bunjs-only-snippets/crypto.test.js')
-rw-r--r--integration/bunjs-only-snippets/crypto.test.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/integration/bunjs-only-snippets/crypto.test.js b/integration/bunjs-only-snippets/crypto.test.js
new file mode 100644
index 000000000..344d935d5
--- /dev/null
+++ b/integration/bunjs-only-snippets/crypto.test.js
@@ -0,0 +1,28 @@
+import { it, expect } from "bun:test";
+
+for (let Hasher of [
+ Bun.SHA1,
+ Bun.SHA256,
+ Bun.SHA384,
+ Bun.SHA512,
+ Bun.SHA512_256,
+]) {
+ it(`${Hasher.name} instance`, () => {
+ var buf = new Uint8Array(256);
+ const result = new Hasher();
+ result.update("hello world");
+ result.final(buf);
+ });
+}
+
+for (let HashFn of [
+ Bun.sha1,
+ Bun.sha256,
+ Bun.sha384,
+ Bun.sha512,
+ Bun.sha512_256,
+]) {
+ it(`${HashFn.name} instance`, () => {
+ HashFn("hello world");
+ });
+}