chore: apply biome formatting
This commit is contained in:
@@ -60,7 +60,10 @@ async function resizeImageBase64IfNeeded(params: {
|
||||
}
|
||||
|
||||
const qualities = [85, 75, 65, 55, 45, 35];
|
||||
const sideStart = maxDim > 0 ? Math.min(params.maxDimensionPx, maxDim) : params.maxDimensionPx;
|
||||
const sideStart =
|
||||
maxDim > 0
|
||||
? Math.min(params.maxDimensionPx, maxDim)
|
||||
: params.maxDimensionPx;
|
||||
const sideGrid = [sideStart, 1800, 1600, 1400, 1200, 1000, 800]
|
||||
.map((v) => Math.min(params.maxDimensionPx, v))
|
||||
.filter((v, i, arr) => v > 0 && arr.indexOf(v) === i)
|
||||
@@ -91,7 +94,9 @@ async function resizeImageBase64IfNeeded(params: {
|
||||
const best = smallest?.buffer ?? buf;
|
||||
const maxMb = (params.maxBytes / (1024 * 1024)).toFixed(0);
|
||||
const gotMb = (best.byteLength / (1024 * 1024)).toFixed(2);
|
||||
throw new Error(`Image could not be reduced below ${maxMb}MB (got ${gotMb}MB)`);
|
||||
throw new Error(
|
||||
`Image could not be reduced below ${maxMb}MB (got ${gotMb}MB)`,
|
||||
);
|
||||
}
|
||||
|
||||
export async function sanitizeContentBlocksImages(
|
||||
|
||||
@@ -318,23 +318,25 @@ describe("web auto-reply", () => {
|
||||
let capturedOnMessage:
|
||||
| ((msg: import("./inbound.js").WebInboundMessage) => Promise<void>)
|
||||
| undefined;
|
||||
const listenerFactory = vi.fn(async (opts: {
|
||||
onMessage: (
|
||||
msg: import("./inbound.js").WebInboundMessage,
|
||||
) => Promise<void>;
|
||||
}) => {
|
||||
capturedOnMessage = opts.onMessage;
|
||||
let resolveClose: (reason: unknown) => void = () => {};
|
||||
const onClose = new Promise<unknown>((res) => {
|
||||
resolveClose = res;
|
||||
closeResolvers.push(res);
|
||||
});
|
||||
return {
|
||||
close: vi.fn(),
|
||||
onClose,
|
||||
signalClose: (reason?: unknown) => resolveClose(reason),
|
||||
};
|
||||
});
|
||||
const listenerFactory = vi.fn(
|
||||
async (opts: {
|
||||
onMessage: (
|
||||
msg: import("./inbound.js").WebInboundMessage,
|
||||
) => Promise<void>;
|
||||
}) => {
|
||||
capturedOnMessage = opts.onMessage;
|
||||
let resolveClose: (reason: unknown) => void = () => {};
|
||||
const onClose = new Promise<unknown>((res) => {
|
||||
resolveClose = res;
|
||||
closeResolvers.push(res);
|
||||
});
|
||||
return {
|
||||
close: vi.fn(),
|
||||
onClose,
|
||||
signalClose: (reason?: unknown) => resolveClose(reason),
|
||||
};
|
||||
},
|
||||
);
|
||||
const runtime = {
|
||||
log: vi.fn(),
|
||||
error: vi.fn(),
|
||||
|
||||
Reference in New Issue
Block a user