Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

pullRequestMediaSource.test.ts

18 lines901 Bytes

1import { describe, expect, it } from "vite-plus/test";
2import { EnvironmentId } from "@t3tools/contracts";
3import { filePreviewGallery } from "../../lib/filePreviewGallery";
4import { pullRequestImageSource } from "./pullRequestMediaSource";
5​
6const location = { environmentId: EnvironmentId.make("test"), cwd: "/repo" };
7const url = "https://github.com/user-attachments/assets/abc-123";
8​
9describe("PR media previews", () => {
10 it("keeps every gallery image resolvable and the tapped image appears only once", () => {
11 const first = pullRequestImageSource(url, location);
12 const second = pullRequestImageSource(`${url}-second`, location);
13 const selected = { ...second, sourceIdentifier: "tapped" };
14 const gallery = filePreviewGallery(selected, [first, second]);
15 expect(gallery).toEqual([first, selected]);
16 expect(gallery.every((item) => "resource" in item)).toBe(true);
17 });
18});