test: fix plugin runtime env test types

This commit is contained in:
Peter Steinberger
2026-04-28 00:11:44 +01:00
parent 1776840c57
commit d74c8423c7
3 changed files with 11 additions and 14 deletions

View File

@@ -1,5 +1,4 @@
import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env";
import { createNonExitingTypedRuntimeEnv } from "openclaw/plugin-sdk/testing";
import { createNonExitingRuntimeEnv } from "openclaw/plugin-sdk/testing";
import { beforeEach, describe, expect, it, vi } from "vitest";
import * as resolveChannelsModule from "../resolve-channels.js";
import * as resolveUsersModule from "../resolve-users.js";
@@ -29,7 +28,7 @@ describe("resolveDiscordAllowlistConfig", () => {
});
it("canonicalizes resolved user names to ids in runtime config", async () => {
const runtime = createNonExitingTypedRuntimeEnv<RuntimeEnv>();
const runtime = createNonExitingRuntimeEnv();
const result = await resolveDiscordAllowlistConfig({
token: "token",
allowFrom: ["Alice", "111", "*"],
@@ -63,7 +62,7 @@ describe("resolveDiscordAllowlistConfig", () => {
channelName: "missing-room",
},
]);
const runtime = createNonExitingTypedRuntimeEnv<RuntimeEnv>();
const runtime = createNonExitingRuntimeEnv();
await resolveDiscordAllowlistConfig({
token: "token",
@@ -116,7 +115,7 @@ describe("resolveDiscordAllowlistConfig", () => {
},
]);
const runtime = createNonExitingTypedRuntimeEnv<RuntimeEnv>();
const runtime = createNonExitingRuntimeEnv();
await resolveDiscordAllowlistConfig({
token: "token",

View File

@@ -3,9 +3,9 @@ import {
resolveInboundDebounceMs,
} from "openclaw/plugin-sdk/channel-inbound-debounce";
import { hasControlCommand } from "openclaw/plugin-sdk/command-detection";
import { createNonExitingTypedRuntimeEnv } from "openclaw/plugin-sdk/testing";
import { createNonExitingRuntimeEnv } from "openclaw/plugin-sdk/testing";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { ClawdbotConfig, PluginRuntime, RuntimeEnv } from "../runtime-api.js";
import type { ClawdbotConfig, PluginRuntime } from "../runtime-api.js";
import { parseFeishuMessageEvent, type FeishuMessageEvent } from "./bot.js";
import * as dedup from "./dedup.js";
import {
@@ -175,7 +175,7 @@ async function setupDebounceMonitor(params?: {
await monitorSingleAccount({
cfg: buildDebounceConfig(),
account: buildDebounceAccount(),
runtime: createNonExitingTypedRuntimeEnv<RuntimeEnv>(),
runtime: createNonExitingRuntimeEnv(),
botOpenIdSource: {
kind: "prefetched",
botOpenId: params?.botOpenId ?? "ou_bot",
@@ -457,7 +457,7 @@ describe("monitorSingleAccount lifecycle", () => {
await monitorSingleAccount({
cfg: buildDebounceConfig(),
account: buildDebounceAccount(),
runtime: createNonExitingTypedRuntimeEnv<RuntimeEnv>(),
runtime: createNonExitingRuntimeEnv(),
botOpenIdSource: {
kind: "prefetched",
botOpenId: "ou_bot",
@@ -482,7 +482,7 @@ describe("monitorSingleAccount lifecycle", () => {
monitorSingleAccount({
cfg: buildDebounceConfig(),
account: buildDebounceAccount(),
runtime: createNonExitingTypedRuntimeEnv<RuntimeEnv>(),
runtime: createNonExitingRuntimeEnv(),
botOpenIdSource: {
kind: "prefetched",
botOpenId: "ou_bot",

View File

@@ -1,5 +1,5 @@
import {
createNonExitingTypedRuntimeEnv,
createNonExitingRuntimeEnv,
createPluginSetupWizardConfigure,
createPluginSetupWizardStatus,
createTestWizardPrompter,
@@ -67,8 +67,6 @@ async function getStatusWithEnvRefs(params: { appIdKey: string; appSecretKey: st
const feishuConfigure = createPluginSetupWizardConfigure(feishuPlugin);
const feishuGetStatus = createPluginSetupWizardStatus(feishuPlugin);
type FeishuConfigureRuntime = Parameters<typeof feishuConfigure>[0]["runtime"];
describe("feishu setup wizard", () => {
it("does not throw when config appId/appSecret are SecretRef objects", async () => {
const text = vi
@@ -95,7 +93,7 @@ describe("feishu setup wizard", () => {
},
} as never,
prompter,
runtime: createNonExitingTypedRuntimeEnv<FeishuConfigureRuntime>(),
runtime: createNonExitingRuntimeEnv(),
}),
).resolves.toBeTruthy();
});