mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 02:50:24 +00:00
test: speed up setup and core extension tests
This commit is contained in:
@@ -2,7 +2,7 @@ import fs from "node:fs";
|
||||
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { validateJsonSchemaValue } from "../../../src/plugins/schema-validator.js";
|
||||
import { qqbotPlugin } from "./channel.js";
|
||||
import { qqbotSetupAdapterShared } from "./channel-config-shared.js";
|
||||
import { qqbotSetupPlugin } from "./channel.setup.js";
|
||||
import { QQBotConfigSchema } from "./config-schema.js";
|
||||
import { DEFAULT_ACCOUNT_ID, resolveDefaultQQBotAccountId, resolveQQBotAccount } from "./config.js";
|
||||
@@ -264,7 +264,7 @@ describe("qqbot config", () => {
|
||||
});
|
||||
|
||||
it("rejects malformed --token consistently across setup paths", () => {
|
||||
const runtimeSetup = qqbotPlugin.setup;
|
||||
const runtimeSetup = qqbotSetupAdapterShared;
|
||||
const lightweightSetup = qqbotSetupPlugin.setup;
|
||||
expect(runtimeSetup).toBeDefined();
|
||||
expect(lightweightSetup).toBeDefined();
|
||||
@@ -272,7 +272,7 @@ describe("qqbot config", () => {
|
||||
const input = { token: "broken", name: "Bad" };
|
||||
|
||||
expect(
|
||||
runtimeSetup!.validateInput?.({
|
||||
runtimeSetup.validateInput?.({
|
||||
cfg: {} as OpenClawConfig,
|
||||
accountId: DEFAULT_ACCOUNT_ID,
|
||||
input,
|
||||
@@ -286,7 +286,7 @@ describe("qqbot config", () => {
|
||||
}),
|
||||
).toBe("QQBot --token must be in appId:clientSecret format");
|
||||
expect(
|
||||
runtimeSetup!.applyAccountConfig?.({
|
||||
runtimeSetup.applyAccountConfig?.({
|
||||
cfg: {} as OpenClawConfig,
|
||||
accountId: DEFAULT_ACCOUNT_ID,
|
||||
input,
|
||||
@@ -302,7 +302,7 @@ describe("qqbot config", () => {
|
||||
});
|
||||
|
||||
it("preserves the --use-env add flow across setup paths", () => {
|
||||
const runtimeSetup = qqbotPlugin.setup;
|
||||
const runtimeSetup = qqbotSetupAdapterShared;
|
||||
const lightweightSetup = qqbotSetupPlugin.setup;
|
||||
expect(runtimeSetup).toBeDefined();
|
||||
expect(lightweightSetup).toBeDefined();
|
||||
@@ -310,7 +310,7 @@ describe("qqbot config", () => {
|
||||
const input = { useEnv: true, name: "Env Bot" };
|
||||
|
||||
expect(
|
||||
runtimeSetup!.applyAccountConfig?.({
|
||||
runtimeSetup.applyAccountConfig?.({
|
||||
cfg: {} as OpenClawConfig,
|
||||
accountId: DEFAULT_ACCOUNT_ID,
|
||||
input,
|
||||
@@ -342,11 +342,11 @@ describe("qqbot config", () => {
|
||||
});
|
||||
|
||||
it("uses configured defaultAccount when runtime setup accountId is omitted", () => {
|
||||
const runtimeSetup = qqbotPlugin.setup;
|
||||
const runtimeSetup = qqbotSetupAdapterShared;
|
||||
expect(runtimeSetup).toBeDefined();
|
||||
|
||||
expect(
|
||||
runtimeSetup!.resolveAccountId?.({
|
||||
runtimeSetup.resolveAccountId?.({
|
||||
cfg: {
|
||||
channels: {
|
||||
qqbot: {
|
||||
@@ -363,7 +363,7 @@ describe("qqbot config", () => {
|
||||
});
|
||||
|
||||
it("rejects --use-env for named accounts across setup paths", () => {
|
||||
const runtimeSetup = qqbotPlugin.setup;
|
||||
const runtimeSetup = qqbotSetupAdapterShared;
|
||||
const lightweightSetup = qqbotSetupPlugin.setup;
|
||||
expect(runtimeSetup).toBeDefined();
|
||||
expect(lightweightSetup).toBeDefined();
|
||||
@@ -371,7 +371,7 @@ describe("qqbot config", () => {
|
||||
const input = { useEnv: true, name: "Env Bot" };
|
||||
|
||||
expect(
|
||||
runtimeSetup!.validateInput?.({
|
||||
runtimeSetup.validateInput?.({
|
||||
cfg: {} as OpenClawConfig,
|
||||
accountId: "bot2",
|
||||
input,
|
||||
@@ -385,7 +385,7 @@ describe("qqbot config", () => {
|
||||
}),
|
||||
).toBe("QQBot --use-env only supports the default account");
|
||||
expect(
|
||||
runtimeSetup!.applyAccountConfig?.({
|
||||
runtimeSetup.applyAccountConfig?.({
|
||||
cfg: {} as OpenClawConfig,
|
||||
accountId: "bot2",
|
||||
input,
|
||||
|
||||
Reference in New Issue
Block a user