From b91d134dc8a8ca47175fdd8f833f2ec10450b661 Mon Sep 17 00:00:00 2001 From: Ajitomi Daisuke Date: Sat, 12 Oct 2024 07:27:55 +0900 Subject: [PATCH] Use isDenoV1 on test. --- packages/hpke-js/test/cipherSuiteNative.test.ts | 4 ++-- packages/hpke-js/test/kemContext.test.ts | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/hpke-js/test/cipherSuiteNative.test.ts b/packages/hpke-js/test/cipherSuiteNative.test.ts index 70140f519..db123b99c 100644 --- a/packages/hpke-js/test/cipherSuiteNative.test.ts +++ b/packages/hpke-js/test/cipherSuiteNative.test.ts @@ -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, @@ -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( diff --git a/packages/hpke-js/test/kemContext.test.ts b/packages/hpke-js/test/kemContext.test.ts index f4fbbf889..66239caae 100644 --- a/packages/hpke-js/test/kemContext.test.ts +++ b/packages/hpke-js/test/kemContext.test.ts @@ -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, @@ -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(); @@ -176,7 +176,7 @@ describe("deriveKeyPair", () => { }); it("should return a proper instance with DhkemP384HkdfSha384", async () => { - if (!isNode()) { + if (isDenoV1()) { return; } const cryptoApi = await loadCrypto(); @@ -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(); @@ -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; } @@ -509,7 +508,7 @@ describe("serialize/deserializePrivateKey", () => { }); it("should return a proper instance with DhkemP384HkdfSha384", async () => { - if (!isNode()) { + if (isDenoV1()) { return; }