





















@@ -845,69 +845,6 @@ describe("gateway server misc", () => {
845845}
846846});
847847848-test("auto-enables configured channel plugins on startup", async () => {
849-const configPath = process.env.OPENCLAW_CONFIG_PATH;
850-if (!configPath) {
851-throw new Error("Missing OPENCLAW_CONFIG_PATH");
852-}
853-let previousConfig: string | undefined;
854-try {
855-previousConfig = await fs.readFile(configPath, "utf-8");
856-} catch (err) {
857-if ((err as NodeJS.ErrnoException).code !== "ENOENT") {
858-throw err;
859-}
860-}
861-862-try {
863-await fs.mkdir(path.dirname(configPath), { recursive: true });
864-await fs.writeFile(
865-configPath,
866-JSON.stringify(
867-{
868-channels: {
869-discord: {
870-token: "token-123",
871-},
872-},
873-},
874-null,
875-2,
876-),
877-"utf-8",
878-);
879-880-await withEnvAsync(
881-{
882-OPENCLAW_TEST_MINIMAL_GATEWAY: undefined,
883-OPENCLAW_DISABLE_BUNDLED_PLUGINS: undefined,
884-OPENCLAW_BUNDLED_PLUGINS_DIR: path.resolve("extensions"),
885-},
886-async () => {
887-const autoPort = await getFreePort();
888-const autoServer = await startGatewayServer(autoPort);
889-await autoServer.close();
890-},
891-);
892-893-const updated = JSON.parse(await fs.readFile(configPath, "utf-8")) as Record<string, unknown>;
894-const channels = updated.channels as Record<string, unknown> | undefined;
895-const discord = channels?.discord as Record<string, unknown> | undefined;
896-expect(discord).toMatchObject({
897-token: "token-123",
898-enabled: true,
899-});
900-} finally {
901-if (previousConfig === undefined) {
902-await fs.rm(configPath, { force: true });
903-} else {
904-await fs.writeFile(configPath, previousConfig, "utf-8");
905-}
906-clearRuntimeConfigSnapshot();
907-clearConfigCache();
908-}
909-});
910-911848test("releases port after close", async () => {
912849const releasePort = await getFreePort();
913850const releaseServer = await startGatewayServer(releasePort);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。