This commit is contained in:
Reinier Criel 2026-04-13 11:01:45 -07:00
parent 1cf8fd1241
commit d064d46668
32 changed files with 429 additions and 400 deletions

View file

@ -2,24 +2,23 @@ import { describe, it, beforeEach, afterEach, mock } from "node:test";
import assert from "node:assert";
describe("certUtils", () => {
let originalSafeChainDir;
let installedSafeChainDir;
beforeEach(() => {
originalSafeChainDir = process.env.SAFE_CHAIN_DIR;
installedSafeChainDir = undefined;
mock.module("../config/safeChainDir.js", {
namedExports: {
getSafeChainBaseDir: () => installedSafeChainDir ?? "/home/test/.safe-chain",
},
});
});
afterEach(() => {
if (originalSafeChainDir === undefined) {
delete process.env.SAFE_CHAIN_DIR;
} else {
process.env.SAFE_CHAIN_DIR = originalSafeChainDir;
}
mock.reset();
});
it("stores CA certificates in SAFE_CHAIN_DIR when configured", async () => {
process.env.SAFE_CHAIN_DIR = "/custom/safe-chain";
it("stores CA certificates in the packaged install dir when available", async () => {
installedSafeChainDir = "/custom/safe-chain";
mock.module("fs", {
defaultExport: {