test: share discord native command fixtures

This commit is contained in:
Peter Steinberger
2026-04-20 21:53:15 +01:00
parent 22f2de0c4f
commit cb869c823e
2 changed files with 2 additions and 45 deletions

View File

@@ -16,7 +16,7 @@ import {
} from "../../../../test/helpers/plugins/plugin-registry.js";
import { resolveDiscordNativeInteractionRouteState } from "./native-command-route.js";
import {
createMockCommandInteraction,
createMockCommandInteraction as createInteraction,
type MockCommandInteraction,
} from "./native-command.test-helpers.js";
import { createNoopThreadBindingManager } from "./thread-bindings.manager.js";
@@ -30,26 +30,6 @@ const runtimeModuleMocks = vi.hoisted(() => ({
resolveDirectStatusReplyForSession: vi.fn(),
}));
function createInteraction(params?: {
channelType?: ChannelType;
channelId?: string;
threadParentId?: string | null;
guildId?: string;
guildName?: string;
}): MockCommandInteraction {
return createMockCommandInteraction({
userId: "owner",
username: "tester",
globalName: "Tester",
channelType: params?.channelType ?? ChannelType.DM,
channelId: params?.channelId ?? "dm-1",
threadParentId: params?.threadParentId,
guildId: params?.guildId ?? null,
guildName: params?.guildName,
interactionId: "interaction-1",
});
}
function createConfig(): OpenClawConfig {
return {
channels: {

View File

@@ -1,10 +1,7 @@
import { ChannelType } from "discord-api-types/v10";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import {
createMockCommandInteraction,
type MockCommandInteraction,
} from "./native-command.test-helpers.js";
import { createMockCommandInteraction as createInteraction } from "./native-command.test-helpers.js";
import { createNoopThreadBindingManager } from "./thread-bindings.js";
const runtimeModuleMocks = vi.hoisted(() => ({
@@ -31,26 +28,6 @@ vi.mock("openclaw/plugin-sdk/command-status-runtime", () => ({
let createDiscordNativeCommand: typeof import("./native-command.js").createDiscordNativeCommand;
let discordNativeCommandTesting: typeof import("./native-command.js").__testing;
function createInteraction(params?: {
channelType?: ChannelType;
channelId?: string;
threadParentId?: string | null;
guildId?: string | null;
guildName?: string;
}): MockCommandInteraction {
return createMockCommandInteraction({
userId: "owner",
username: "tester",
globalName: "Tester",
channelType: params?.channelType ?? ChannelType.DM,
channelId: params?.channelId ?? "dm-1",
threadParentId: params?.threadParentId,
guildId: params?.guildId ?? null,
guildName: params?.guildName,
interactionId: "interaction-1",
});
}
function createConfig(params?: { requireMention?: boolean }): OpenClawConfig {
return {
commands: {