All checks were successful
PR checks / checks (pull_request) Successful in 31s
Companies can upload a logo and a stamp/seal (Admin → Companies → Edit → Branding); both render on exported PDF and XLSX purchase orders. A fixed brand-colour bar (#92D050, matching the sample PO) runs along the bottom of every export. - Company.logoKey / stampKey + migration - buildCompanyAssetKey() deterministic storage keys (overwrite-in-place) - uploadCompanyAsset / removeCompanyAsset server actions (≤4MB PNG/JPG/WebP, manage_vessels_accounts gated) - CompanyBrandingUploader in the company edit dialog with live previews - Export route embeds logo (top-left), stamp (signatory block) and brand bar in both ExcelJS and print-HTML paths - Unit test (storage keys) + integration test (branding actions) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { buildCompanyAssetKey, buildSignatureKey } from "@/lib/storage";
|
|
|
|
describe("buildCompanyAssetKey", () => {
|
|
it("builds a deterministic logo key under the company namespace", () => {
|
|
expect(buildCompanyAssetKey("cmp123", "logo", "png")).toBe("company-assets/cmp123/logo.png");
|
|
});
|
|
|
|
it("builds a deterministic stamp key", () => {
|
|
expect(buildCompanyAssetKey("cmp123", "stamp", "webp")).toBe("company-assets/cmp123/stamp.webp");
|
|
});
|
|
|
|
it("is stable across re-uploads of the same type (overwrites in place)", () => {
|
|
const a = buildCompanyAssetKey("c1", "logo", "png");
|
|
const b = buildCompanyAssetKey("c1", "logo", "png");
|
|
expect(a).toBe(b);
|
|
});
|
|
|
|
it("separates logo and stamp into distinct keys", () => {
|
|
expect(buildCompanyAssetKey("c1", "logo", "png")).not.toBe(buildCompanyAssetKey("c1", "stamp", "png"));
|
|
});
|
|
});
|
|
|
|
describe("buildSignatureKey", () => {
|
|
it("keeps signatures in their own namespace", () => {
|
|
expect(buildSignatureKey("u1", "png")).toBe("signatures/u1.png");
|
|
});
|
|
});
|