From ffbb1bad037528863fcc191f0eaf374211252713 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Wed, 7 Feb 2024 09:51:28 -0700 Subject: chore(cli): Use @test_util for relative path for unit tests (#22327) This removes the majority of `../../../../../../test_util` relative imports from the codebase, allowing us to move this code more easily in the future. --- cli/tests/unit_node/crypto/crypto_cipher_gcm_test.ts | 2 +- cli/tests/unit_node/crypto/crypto_cipher_test.ts | 5 +---- cli/tests/unit_node/crypto/crypto_hash_test.ts | 2 +- cli/tests/unit_node/crypto/crypto_key_test.ts | 5 +---- cli/tests/unit_node/crypto/crypto_sign_test.ts | 5 +---- 5 files changed, 5 insertions(+), 14 deletions(-) (limited to 'cli/tests/unit_node/crypto') diff --git a/cli/tests/unit_node/crypto/crypto_cipher_gcm_test.ts b/cli/tests/unit_node/crypto/crypto_cipher_gcm_test.ts index 6c500f9f2..b7b616546 100644 --- a/cli/tests/unit_node/crypto/crypto_cipher_gcm_test.ts +++ b/cli/tests/unit_node/crypto/crypto_cipher_gcm_test.ts @@ -4,7 +4,7 @@ import crypto from "node:crypto"; import { Buffer } from "node:buffer"; import testVectors128 from "./gcmEncryptExtIV128.json" assert { type: "json" }; import testVectors256 from "./gcmEncryptExtIV256.json" assert { type: "json" }; -import { assertEquals } from "../../../../test_util/std/assert/mod.ts"; +import { assertEquals } from "@test_util/std/assert/mod.ts"; const aesGcm = (bits: string, key: Uint8Array) => { const ALGO = bits == "128" ? `aes-128-gcm` : `aes-256-gcm`; diff --git a/cli/tests/unit_node/crypto/crypto_cipher_test.ts b/cli/tests/unit_node/crypto/crypto_cipher_test.ts index 7ea361bf6..3da7ae3f1 100644 --- a/cli/tests/unit_node/crypto/crypto_cipher_test.ts +++ b/cli/tests/unit_node/crypto/crypto_cipher_test.ts @@ -3,10 +3,7 @@ import crypto from "node:crypto"; import { Buffer } from "node:buffer"; import { Readable } from "node:stream"; import { buffer, text } from "node:stream/consumers"; -import { - assertEquals, - assertThrows, -} from "../../../../test_util/std/assert/mod.ts"; +import { assertEquals, assertThrows } from "@test_util/std/assert/mod.ts"; const rsaPrivateKey = Deno.readTextFileSync( new URL("../testdata/rsa_private.pem", import.meta.url), diff --git a/cli/tests/unit_node/crypto/crypto_hash_test.ts b/cli/tests/unit_node/crypto/crypto_hash_test.ts index e1bb4de8a..ff1c9c598 100644 --- a/cli/tests/unit_node/crypto/crypto_hash_test.ts +++ b/cli/tests/unit_node/crypto/crypto_hash_test.ts @@ -8,7 +8,7 @@ import { } from "node:crypto"; import { Buffer } from "node:buffer"; import { Readable } from "node:stream"; -import { assert, assertEquals } from "../../../../test_util/std/assert/mod.ts"; +import { assert, assertEquals } from "@test_util/std/assert/mod.ts"; // https://github.com/denoland/deno/issues/18140 Deno.test({ diff --git a/cli/tests/unit_node/crypto/crypto_key_test.ts b/cli/tests/unit_node/crypto/crypto_key_test.ts index 3ad195df1..8d1b24b21 100644 --- a/cli/tests/unit_node/crypto/crypto_key_test.ts +++ b/cli/tests/unit_node/crypto/crypto_key_test.ts @@ -11,10 +11,7 @@ import { } from "node:crypto"; import { promisify } from "node:util"; import { Buffer } from "node:buffer"; -import { - assertEquals, - assertThrows, -} from "../../../../test_util/std/assert/mod.ts"; +import { assertEquals, assertThrows } from "@test_util/std/assert/mod.ts"; import { createHmac } from "node:crypto"; const RUN_SLOW_TESTS = Deno.env.get("SLOW_TESTS") === "1"; diff --git a/cli/tests/unit_node/crypto/crypto_sign_test.ts b/cli/tests/unit_node/crypto/crypto_sign_test.ts index 000f2311a..287b54cc1 100644 --- a/cli/tests/unit_node/crypto/crypto_sign_test.ts +++ b/cli/tests/unit_node/crypto/crypto_sign_test.ts @@ -1,9 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -import { - assert, - assertEquals, -} from "../../../../test_util/std/testing/asserts.ts"; +import { assert, assertEquals } from "@test_util/std/testing/asserts.ts"; import { createSign, createVerify, sign, verify } from "node:crypto"; import { Buffer } from "node:buffer"; -- cgit v1.2.3