mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 19:54:57 +00:00
test: dedupe gateway browser discord and channel coverage
This commit is contained in:
@@ -91,7 +91,7 @@ vi.mock("../../config/sessions.js", async (importOriginal) => {
|
||||
describe("agent components", () => {
|
||||
const createCfg = (): OpenClawConfig => ({}) as OpenClawConfig;
|
||||
|
||||
const createDmButtonInteraction = (overrides: Partial<ButtonInteraction> = {}) => {
|
||||
const createBaseDmInteraction = (overrides: Record<string, unknown> = {}) => {
|
||||
const reply = vi.fn().mockResolvedValue(undefined);
|
||||
const defer = vi.fn().mockResolvedValue(undefined);
|
||||
const interaction = {
|
||||
@@ -100,22 +100,31 @@ describe("agent components", () => {
|
||||
defer,
|
||||
reply,
|
||||
...overrides,
|
||||
} as unknown as ButtonInteraction;
|
||||
};
|
||||
return { interaction, defer, reply };
|
||||
};
|
||||
|
||||
const createDmSelectInteraction = (overrides: Partial<StringSelectMenuInteraction> = {}) => {
|
||||
const reply = vi.fn().mockResolvedValue(undefined);
|
||||
const defer = vi.fn().mockResolvedValue(undefined);
|
||||
const interaction = {
|
||||
rawData: { channel_id: "dm-channel" },
|
||||
user: { id: "123456789", username: "Alice", discriminator: "1234" },
|
||||
values: ["alpha"],
|
||||
const createDmButtonInteraction = (overrides: Partial<ButtonInteraction> = {}) => {
|
||||
const { interaction, defer, reply } = createBaseDmInteraction(
|
||||
overrides as Record<string, unknown>,
|
||||
);
|
||||
return {
|
||||
interaction: interaction as unknown as ButtonInteraction,
|
||||
defer,
|
||||
reply,
|
||||
...overrides,
|
||||
} as unknown as StringSelectMenuInteraction;
|
||||
return { interaction, defer, reply };
|
||||
};
|
||||
};
|
||||
|
||||
const createDmSelectInteraction = (overrides: Partial<StringSelectMenuInteraction> = {}) => {
|
||||
const { interaction, defer, reply } = createBaseDmInteraction({
|
||||
values: ["alpha"],
|
||||
...(overrides as Record<string, unknown>),
|
||||
});
|
||||
return {
|
||||
interaction: interaction as unknown as StringSelectMenuInteraction,
|
||||
defer,
|
||||
reply,
|
||||
};
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
Reference in New Issue
Block a user