Skip to content

Commit

Permalink
Merge pull request #426 from dajiaji/use-is-deno-v1
Browse files Browse the repository at this point in the history
Use isDenoV1 on test.
  • Loading branch information
dajiaji authored Oct 11, 2024
2 parents b0bd993 + b91d134 commit 9ae4e67
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/hpke-js/test/cipherSuiteNative.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { assertEquals, assertRejects, assertThrows } from "@std/assert";
import { describe, it } from "@std/testing/bdd";

import { concat, hexToBytes, isNode, loadCrypto } from "@hpke/common";
import { concat, hexToBytes, isDenoV1, loadCrypto } from "@hpke/common";
import {
AeadId,
Aes128Gcm,
Expand Down Expand Up @@ -540,7 +540,7 @@ describe("deriveKeyPair", () => {

describe("with official test-vector for DhkemP256HkdfSha256.", () => {
it("should derive a proper key pair.", async () => {
if (!isNode()) {
if (isDenoV1()) {
return;
}
const ikmR = hexToBytes(
Expand Down
13 changes: 6 additions & 7 deletions packages/hpke-js/test/kemContext.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { assertEquals, assertRejects } from "@std/assert";
import { describe, it } from "@std/testing/bdd";

import { isNode, loadCrypto } from "@hpke/common";
import { isDenoV1, isNode, loadCrypto } from "@hpke/common";
import {
DeriveKeyPairError,
DeserializeError,
Expand Down Expand Up @@ -152,7 +152,7 @@ describe("generateKeyPair", () => {
describe("deriveKeyPair", () => {
describe("with valid parameters", () => {
it("should return a proper instance with DhkemP256HkdfSha256", async () => {
if (!isNode()) {
if (isDenoV1()) {
return;
}
const cryptoApi = await loadCrypto();
Expand All @@ -176,7 +176,7 @@ describe("deriveKeyPair", () => {
});

it("should return a proper instance with DhkemP384HkdfSha384", async () => {
if (!isNode()) {
if (isDenoV1()) {
return;
}
const cryptoApi = await loadCrypto();
Expand Down Expand Up @@ -280,8 +280,7 @@ describe("deriveKeyPair", () => {

describe("with invalid parameters", () => {
it("should throw NotSupportedError with DhkemP256HkdfSha256", async () => {
// deno-lint-ignore no-explicit-any
if ((globalThis as any).process !== undefined) {
if (!isDenoV1()) {
return;
}
const cryptoApi = await loadCrypto();
Expand Down Expand Up @@ -491,7 +490,7 @@ describe("serialize/deserializePublicKey", () => {
describe("serialize/deserializePrivateKey", () => {
describe("with valid parameters", () => {
it("should return a proper instance with DhkemP256HkdfSha256", async () => {
if (!isNode()) {
if (isDenoV1()) {
return;
}

Expand All @@ -509,7 +508,7 @@ describe("serialize/deserializePrivateKey", () => {
});

it("should return a proper instance with DhkemP384HkdfSha384", async () => {
if (!isNode()) {
if (isDenoV1()) {
return;
}

Expand Down

0 comments on commit 9ae4e67

Please sign in to comment.