mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:00:43 +00:00
test(extensions): stabilize ci test assertions
This commit is contained in:
@@ -20,19 +20,31 @@ type DispatchReplyContext = Record<string, unknown> & {
|
||||
type DispatchReplyDispatcher = {
|
||||
sendFinalReply: (payload: { text: string }) => unknown;
|
||||
};
|
||||
type FeishuReplyDispatcherMockValue = {
|
||||
dispatcher: DispatchReplyDispatcher;
|
||||
replyOptions: Record<string, never>;
|
||||
markDispatchIdle: () => unknown;
|
||||
};
|
||||
type CreateFeishuReplyDispatcherMock = Mock<(params?: unknown) => FeishuReplyDispatcherMockValue>;
|
||||
type DispatchReplyFromConfigMock = Mock<
|
||||
(params: {
|
||||
ctx: DispatchReplyContext;
|
||||
dispatcher: DispatchReplyDispatcher;
|
||||
}) => Promise<{ queuedFinal: boolean; counts: DispatchReplyCounts }>
|
||||
>;
|
||||
type WithReplyDispatcherMock = Mock<(params: { run: () => unknown }) => Promise<unknown>>;
|
||||
type WithReplyDispatcherMock = Mock<
|
||||
(params: {
|
||||
dispatcher?: DispatchReplyDispatcher;
|
||||
onSettled?: () => unknown;
|
||||
run: () => unknown;
|
||||
}) => Promise<unknown>
|
||||
>;
|
||||
type FeishuLifecycleTestMocks = {
|
||||
createEventDispatcherMock: UnknownMock;
|
||||
monitorWebSocketMock: AsyncUnknownMock;
|
||||
monitorWebhookMock: AsyncUnknownMock;
|
||||
createFeishuThreadBindingManagerMock: UnknownMock;
|
||||
createFeishuReplyDispatcherMock: UnknownMock;
|
||||
createFeishuReplyDispatcherMock: CreateFeishuReplyDispatcherMock;
|
||||
resolveBoundConversationMock: Mock<() => BoundConversation | null>;
|
||||
touchBindingMock: UnknownMock;
|
||||
resolveAgentRouteMock: UnknownMock;
|
||||
|
||||
@@ -36,7 +36,10 @@ async function expectDirectoryIds(
|
||||
) {
|
||||
const entries = await listDirectoryEntriesWithDefaults(listFn, cfg);
|
||||
const ids = entries.map((entry) => entry.id);
|
||||
expect(options?.sorted ? ids.toSorted((a, b) => a.localeCompare(b)) : ids).toEqual(expected);
|
||||
const sortIds = (values: string[]) => values.toSorted((a, b) => a.localeCompare(b));
|
||||
expect(options?.sorted ? sortIds(ids) : ids).toEqual(
|
||||
options?.sorted ? sortIds(expected) : expected,
|
||||
);
|
||||
}
|
||||
|
||||
describe("Telegram directory contract", () => {
|
||||
|
||||
Reference in New Issue
Block a user