Skip to content

Commit 94bc11c

Browse files
test: prevent config to be updated (#461)
1 parent 7341cd1 commit 94bc11c

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

scripts/clear-cache.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import cacache from "cacache";
33

44
// Import Internal Dependencies
5-
import { CACHE_PATH } from "../src/http-server/cache.js";
5+
import { CACHE_PATH } from "../src/cache.js";
66

77
await cacache.rm.all(CACHE_PATH);
88

test/cache.test.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Import Node.js Dependencies
22
import assert from "node:assert/strict";
3-
import { before, describe, it } from "node:test";
3+
import { after, before, describe, it } from "node:test";
44
import fs from "node:fs";
55
import path from "node:path";
66
import os from "node:os";
@@ -10,13 +10,21 @@ import cacache from "cacache";
1010

1111
// Import Internal Dependencies
1212
import { appCache } from "../src/cache.js";
13+
import * as config from "../src/http-server/config.js";
1314

1415
// CONSTANTS
1516
const kPayloadsPath = path.join(os.homedir(), ".nsecure", "payloads");
1617

1718
describe("appCache", () => {
18-
before(() => {
19+
let actualConfig;
20+
21+
before(async() => {
1922
appCache.prefix = "test_runner";
23+
actualConfig = await config.get();
24+
});
25+
26+
after(async() => {
27+
await config.set(actualConfig);
2028
});
2129

2230
it("should update and get config", async() => {

0 commit comments

Comments
 (0)