test(extensions): stabilize ci test assertions

This commit is contained in:
Peter Steinberger
2026-04-20 18:08:17 +01:00
parent 84065b9a68
commit 4edc64037c
2 changed files with 18 additions and 3 deletions

View File

@@ -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;

View File

@@ -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", () => {