test: fix ci env-sensitive assertions

This commit is contained in:
Peter Steinberger
2026-03-23 07:25:39 +00:00
parent 83e715cdaa
commit 0b58829364
2 changed files with 9 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest";
import { afterEach, describe, expect, it, vi } from "vitest";
import {
createDirectoryTestRuntime,
expectDirectorySurface,
@@ -19,6 +19,10 @@ describe("msteams directory", () => {
const runtimeEnv = createDirectoryTestRuntime() as RuntimeEnv;
const directorySelf = requireDirectorySelf(msteamsPlugin.directory);
afterEach(() => {
vi.unstubAllEnvs();
});
describe("self()", () => {
it("returns bot identity when credentials are configured", async () => {
const cfg = {
@@ -36,6 +40,9 @@ describe("msteams directory", () => {
});
it("returns null when credentials are not configured", async () => {
vi.stubEnv("MSTEAMS_APP_ID", "");
vi.stubEnv("MSTEAMS_APP_PASSWORD", "");
vi.stubEnv("MSTEAMS_TENANT_ID", "");
const cfg = { channels: {} } as unknown as OpenClawConfig;
const result = await directorySelf({ cfg, runtime: runtimeEnv });
expect(result).toBeNull();

View File

@@ -12,6 +12,6 @@ describe("SynologyChatChannelConfigSchema", () => {
});
it("keeps the schema open for plugin-specific passthrough fields", () => {
expect(SynologyChatChannelConfigSchema.schema.additionalProperties).toBe(true);
expect([true, {}]).toContainEqual(SynologyChatChannelConfigSchema.schema.additionalProperties);
});
});