feat: stream originals with download accounting

This commit is contained in:
Leon Tonhäuser committed 2026-08-10 13:10:13 +02:00
1 parent c400167b8f
commit 8871e4794a
28 files changed
+4081 -8

No files matched your search

+44 -2
View File
@@ -1,10 +1,12 @@
// @vitest-environment jsdom
import { render, screen } from "@testing-library/react";
import { expect, test } from "vitest";
import { cleanup, render, screen } from "@testing-library/react";
import { afterEach, expect, test } from "vitest";
import { AlbumContactSheet, PhotoContactSheet } from "./catalog-content";
afterEach(cleanup);
test("renders granted albums as labelled contact-sheet links", () => {
render(
<AlbumContactSheet
@@ -60,3 +62,43 @@ test("renders a labelled photo search and descriptive contact-sheet metadata", (
expect(screen.getByText("tor-des-sieges.jpg")).not.toBeNull();
expect(screen.getByText(/1 foto gefunden/i)).not.toBeNull();
});
test("renders the server-scoped download choices for a catalog photo", () => {
render(
<PhotoContactSheet
albumId="33333333-3333-4333-8333-333333333333"
albumName="Heimspiel gegen Nord"
downloadOptions={{
priceCents: 1_500,
priorUsagesByAsset: {
"22222222-2222-4222-8222-222222222222": [
{
id: "44444444-4444-4444-8444-444444444444",
purpose: "Titelgeschichte",
createdAt: "2026-08-09T10:00:00.000Z",
},
],
},
}}
page={{
items: [
{
id: "22222222-2222-4222-8222-222222222222",
type: "IMAGE",
originalFileName: "tor.jpg",
originalMimeType: "image/jpeg",
localDateTime: null,
fileCreatedAt: null,
albums: [{ id: "33333333-3333-4333-8333-333333333333" }],
},
],
total: 1,
nextPage: null,
previousPage: null,
}}
query=""
/>,
);
expect(screen.getByRole("button", { name: /original laden/i })).not.toBeNull();
});