26 lines
793 B
TypeScript
26 lines
793 B
TypeScript
import type { CoverCandidate, InspectedCover } from "../../src/core/model";
|
|
|
|
let n = 0;
|
|
/** A plausible InspectedCover for unit tests; override what the test is about. */
|
|
export function inspected(
|
|
overrides: { candidate?: Partial<CoverCandidate> } & Partial<Omit<InspectedCover, "candidate">> = {},
|
|
): InspectedCover {
|
|
n++;
|
|
const { candidate, ...rest } = overrides;
|
|
const url = candidate?.url ?? `https://swebtoon-phinf.pstatic.net/x/${n}.jpg`;
|
|
return {
|
|
candidate: { url, role: "poster", current: true, ...candidate },
|
|
fetchedFrom: url,
|
|
live: true,
|
|
width: 480,
|
|
height: 623,
|
|
sha256: n.toString(16).padStart(64, "0"),
|
|
contentType: "image/jpeg",
|
|
ext: "jpg",
|
|
bytes: new Uint8Array([n]),
|
|
shape: "portrait",
|
|
type: "volume",
|
|
...rest,
|
|
};
|
|
}
|