Skip to content

Commit a7a0d95

Browse files
committed
fix file-server conat test to work with self-contained testing conat server
1 parent e69485f commit a7a0d95

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/packages/file-server/conat/local-path.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
import { fsServer } from "@cocalc/conat/files/fs";
2-
import { conat } from "@cocalc/backend/conat";
32
import { SandboxedFilesystem } from "@cocalc/file-server/fs/sandbox";
43
import { mkdir } from "fs/promises";
54
import { join } from "path";
65
import { isValidUUID } from "@cocalc/util/misc";
6+
import { type Client, getClient } from "@cocalc/conat/core/client";
77

88
export function localPathFileserver({
99
service,
1010
path,
11+
client,
1112
}: {
1213
service: string;
1314
path: string;
15+
client?: Client;
1416
}) {
15-
const client = conat();
17+
client ??= getClient();
1618
const server = fsServer({
1719
service,
1820
client,

src/packages/file-server/conat/test/local-path.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@ import { tmpdir } from "node:os";
44
import { join } from "path";
55
import { fsClient } from "@cocalc/conat/files/fs";
66
import { randomId } from "@cocalc/conat/names";
7+
import { before, after, client } from "@cocalc/backend/conat/test/setup";
78

89
let tempDir;
910
beforeAll(async () => {
11+
await before();
1012
tempDir = await mkdtemp(join(tmpdir(), "cocalc-local-path"));
1113
});
1214

1315
describe("use the simple fileserver", () => {
1416
const service = `fs-${randomId()}`;
1517
let server;
1618
it("creates the simple fileserver service", async () => {
17-
server = await localPathFileserver({ service, path: tempDir });
19+
server = await localPathFileserver({ client, service, path: tempDir });
1820
});
1921

2022
const project_id = "6b851643-360e-435e-b87e-f9a6ab64a8b1";
@@ -104,5 +106,6 @@ describe("use the simple fileserver", () => {
104106
});
105107

106108
afterAll(async () => {
109+
await after();
107110
await rm(tempDir, { force: true, recursive: true });
108111
});

0 commit comments

Comments
 (0)