mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 20:38:27 +00:00
fix(media): strip MEDIA: prefix in loadWebMediaInternal (#13107)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: 9d95e6af5a
Co-authored-by: mcaxtr <7562095+mcaxtr@users.noreply.github.com>
Co-authored-by: steipete <58493+steipete@users.noreply.github.com>
Reviewed-by: @steipete
This commit is contained in:
@@ -3,9 +3,12 @@ import fsSync from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { afterEach, beforeEach, vi } from "vitest";
|
||||
import type { MockFn } from "../test-utils/vitest-mock-fn.js";
|
||||
import { resetLogger, setLoggerOverride } from "../logging.js";
|
||||
|
||||
// Avoid exporting vitest mock types (TS2742 under pnpm + d.ts emit).
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
type AnyMockFn = any;
|
||||
|
||||
export const DEFAULT_ACCOUNT_ID = "default";
|
||||
|
||||
export const DEFAULT_WEB_INBOX_CONFIG = {
|
||||
@@ -21,28 +24,24 @@ export const DEFAULT_WEB_INBOX_CONFIG = {
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const mockLoadConfig: MockFn<() => typeof DEFAULT_WEB_INBOX_CONFIG> = vi
|
||||
.fn()
|
||||
.mockReturnValue(DEFAULT_WEB_INBOX_CONFIG);
|
||||
export const mockLoadConfig: AnyMockFn = vi.fn().mockReturnValue(DEFAULT_WEB_INBOX_CONFIG);
|
||||
|
||||
export const readAllowFromStoreMock: MockFn<(...args: unknown[]) => Promise<unknown[]>> = vi
|
||||
export const readAllowFromStoreMock: AnyMockFn = vi.fn().mockResolvedValue([]);
|
||||
export const upsertPairingRequestMock: AnyMockFn = vi
|
||||
.fn()
|
||||
.mockResolvedValue([]);
|
||||
export const upsertPairingRequestMock: MockFn<
|
||||
(...args: unknown[]) => Promise<{ code: string; created: boolean }>
|
||||
> = vi.fn().mockResolvedValue({ code: "PAIRCODE", created: true });
|
||||
.mockResolvedValue({ code: "PAIRCODE", created: true });
|
||||
|
||||
export type MockSock = {
|
||||
ev: EventEmitter;
|
||||
ws: { close: MockFn };
|
||||
sendPresenceUpdate: MockFn;
|
||||
sendMessage: MockFn;
|
||||
readMessages: MockFn;
|
||||
updateMediaMessage: MockFn;
|
||||
ws: { close: AnyMockFn };
|
||||
sendPresenceUpdate: AnyMockFn;
|
||||
sendMessage: AnyMockFn;
|
||||
readMessages: AnyMockFn;
|
||||
updateMediaMessage: AnyMockFn;
|
||||
logger: Record<string, unknown>;
|
||||
signalRepository: {
|
||||
lidMapping: {
|
||||
getPNForLID: MockFn;
|
||||
getPNForLID: AnyMockFn;
|
||||
};
|
||||
};
|
||||
user: { id: string };
|
||||
|
||||
Reference in New Issue
Block a user