refactor: trim discord test helper exports · openclaw/openclaw@d0e83b0
steipete
·
2026-05-01
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -12,14 +12,14 @@ type RawInteractionOverrides = Omit<Partial<RawInteraction>, "data" | "type"> &
|
12 | 12 | data?: Record<string, unknown>; |
13 | 13 | }; |
14 | 14 | |
15 | | -export type FakeRestCall = { |
| 15 | +type FakeRestCall = { |
16 | 16 | method: RestMethod; |
17 | 17 | path: string; |
18 | 18 | data?: RequestData; |
19 | 19 | query?: QueuedRequest["query"]; |
20 | 20 | }; |
21 | 21 | |
22 | | -export type FakeRestClient = RequestClient & { |
| 22 | +type FakeRestClient = RequestClient & { |
23 | 23 | calls: FakeRestCall[]; |
24 | 24 | enqueueResponse: (value: unknown) => void; |
25 | 25 | }; |
@@ -70,7 +70,7 @@ export function createInternalTestClient(commands: BaseCommand[] = []): Client {
|
70 | 70 | ); |
71 | 71 | } |
72 | 72 | |
73 | | -export function createRestMock(overrides: RestMock = {}): RestMock & RequestClient { |
| 73 | +function createRestMock(overrides: RestMock = {}): RestMock & RequestClient { |
74 | 74 | return { |
75 | 75 | get: vi.fn(async () => undefined), |
76 | 76 | post: vi.fn(async () => undefined), |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -41,13 +41,13 @@ export function createDiscordOutboundHoisted(): DiscordOutboundHoisted {
|
41 | 41 | }; |
42 | 42 | } |
43 | 43 | |
44 | | -export const DEFAULT_DISCORD_SEND_RESULT = { |
| 44 | +const DEFAULT_DISCORD_SEND_RESULT = { |
45 | 45 | channel: "discord", |
46 | 46 | messageId: "msg-1", |
47 | 47 | channelId: "ch-1", |
48 | 48 | } as const; |
49 | 49 | |
50 | | -export async function createDiscordSendModuleMock( |
| 50 | +async function createDiscordSendModuleMock( |
51 | 51 | hoisted: DiscordOutboundHoisted, |
52 | 52 | loadActual: () => Promise<DiscordSendModule>, |
53 | 53 | ): Promise<DiscordSendModule> { |
@@ -79,7 +79,7 @@ export async function createDiscordSendModuleMock(
|
79 | 79 | }; |
80 | 80 | } |
81 | 81 | |
82 | | -export async function createDiscordSendComponentsModuleMock( |
| 82 | +async function createDiscordSendComponentsModuleMock( |
83 | 83 | hoisted: DiscordOutboundHoisted, |
84 | 84 | loadActual: () => Promise<DiscordSendComponentsModule>, |
85 | 85 | ): Promise<DiscordSendComponentsModule> { |
@@ -96,7 +96,7 @@ export async function createDiscordSendComponentsModuleMock(
|
96 | 96 | }; |
97 | 97 | } |
98 | 98 | |
99 | | -export async function createDiscordThreadBindingsModuleMock( |
| 99 | +async function createDiscordThreadBindingsModuleMock( |
100 | 100 | hoisted: DiscordOutboundHoisted, |
101 | 101 | loadActual: () => Promise<DiscordThreadBindingsModule>, |
102 | 102 | ): Promise<DiscordThreadBindingsModule> { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -48,9 +48,9 @@ export const upsertPairingRequestMock: AsyncUnknownMock = runtimeMocks.upsertPai
|
48 | 48 | export const recordInboundSessionMock: AsyncUnknownMock = runtimeMocks.recordInboundSessionMock; |
49 | 49 | export const readSessionUpdatedAtMock: UnknownMock = runtimeMocks.readSessionUpdatedAtMock; |
50 | 50 | export const resolveStorePathMock: UnknownMock = runtimeMocks.resolveStorePathMock; |
51 | | -export const resolvePluginConversationBindingApprovalMock: AsyncUnknownMock = |
| 51 | +const resolvePluginConversationBindingApprovalMock: AsyncUnknownMock = |
52 | 52 | runtimeMocks.resolvePluginConversationBindingApprovalMock; |
53 | | -export const buildPluginBindingResolvedTextMock: UnknownMock = |
| 53 | +const buildPluginBindingResolvedTextMock: UnknownMock = |
54 | 54 | runtimeMocks.buildPluginBindingResolvedTextMock; |
55 | 55 | |
56 | 56 | async function readStoreAllowFromForDmPolicy(params: { |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | | -export const DISCORD_PARTIAL_CHANNEL_RAW_DATA_ERROR = |
| 1 | +const DISCORD_PARTIAL_CHANNEL_RAW_DATA_ERROR = |
2 | 2 | "Cannot access rawData on partial Channel. Use fetch() to populate data."; |
3 | 3 | |
4 | 4 | export function defineThrowingDiscordChannelGetter( |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -3,13 +3,13 @@ import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env";
|
3 | 3 | import type { Mock } from "vitest"; |
4 | 4 | import { expect, vi } from "vitest"; |
5 | 5 | |
6 | | -export type NativeCommandSpecMock = { |
| 6 | +type NativeCommandSpecMock = { |
7 | 7 | name: string; |
8 | 8 | description: string; |
9 | 9 | acceptsArgs: boolean; |
10 | 10 | }; |
11 | 11 | |
12 | | -export type PluginCommandSpecMock = { |
| 12 | +type PluginCommandSpecMock = { |
13 | 13 | name: string; |
14 | 14 | description: string; |
15 | 15 | acceptsArgs: boolean; |
@@ -65,7 +65,7 @@ type ProviderMonitorTestMocks = {
|
65 | 65 | voiceRuntimeModuleLoadedMock: Mock<() => void>; |
66 | 66 | }; |
67 | 67 | |
68 | | -export function baseDiscordAccountConfig() { |
| 68 | +function baseDiscordAccountConfig() { |
69 | 69 | return { |
70 | 70 | commands: { native: true, nativeSkills: false }, |
71 | 71 | voice: { enabled: false }, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。