mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 09:20:43 +00:00
test: fix plugin runtime env test types
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user