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

filePreviewGallery.test.ts

27 lines948 Bytes

1import { describe, expect, it } from "vite-plus/test";
2import { EnvironmentId } from "@t3tools/contracts";
3import type { FilePreviewItem } from "../components/FilePreviewModal.types";
4import { filePreviewGallery, filePreviewKey } from "./filePreviewGallery";
5​
6describe("image preview groups", () => {
7 it("matches remote originals despite metadata and property order differences", () => {
8 const environmentId = EnvironmentId.make("test");
9 const a: FilePreviewItem = {
10 kind: "image",
11 environmentId,
12 resource: { _tag: "attachment", attachmentId: "a", fileName: "old.png" },
13 };
14 const b: FilePreviewItem = {
15 kind: "image",
16 environmentId,
17 resource: {
18 attachmentId: "a",
19 _tag: "attachment",
20 fileName: "new.png",
21 mimeType: "image/png",
22 },
23 };
24 expect(filePreviewKey(a)).toBe(filePreviewKey(b));
25 expect(filePreviewGallery(b, [a])).toEqual([b]);
26 });
27});