1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-27 01:29:14 -05:00
denoland-deno/cli/tests/unit_node/crypto/crypto_hash_test.ts
Matt Mastracci 612226de8e
chore(cli): One Rust test per JS and Node unit test file (#19199)
This runs our `js_unit_tests` and `node_unit_tests` in parallel, one
rust test per JS unit test file. Some of our JS tests don't like running
in parallel due to port requirements, so this also makes those use a
specific port-per-file. This does not attempt to make the node-compat
tests work.
2023-05-22 13:35:59 -06:00

24 lines
699 B
TypeScript

// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { createHash, createHmac } from "node:crypto";
import { assertEquals } from "../../../../test_util/std/testing/asserts.ts";
// https://github.com/denoland/deno/issues/18140
Deno.test({
name: "createHmac digest",
fn() {
assertEquals(
createHmac("sha256", "secret").update("hello").digest("hex"),
"88aab3ede8d3adf94d26ab90d3bafd4a2083070c3bcce9c014ee04a443847c0b",
);
},
});
Deno.test({
name: "createHash digest",
fn() {
assertEquals(
createHash("sha256").update("hello").digest("hex"),
"2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824",
);
},
});