Files
community-rule/tests/unit/extractUploadIds.test.ts
T
adilallo 5cbda35e32 Start every Rule private, with a rotating link and files that follow its readers.
New Rules stay off lists until the person who holds the pen turns on a share link, or the team features one. Uploaded files are readable only by those readers, stripped of location metadata, and deleted with the Rule, draft, or account.
2026-11-09 19:54:04 -07:00

21 lines
653 B
TypeScript

import { describe, expect, it } from "vitest";
import { extractUploadIdsFromUnknown } from "../../lib/server/uploads/extractUploadIds";
const ID = "550e8400-e29b-41d4-a716-446655440000";
describe("extractUploadIdsFromUnknown", () => {
it("collects unique upload ids from nested JSON", () => {
expect(
extractUploadIdsFromUnknown({
logo: `/api/uploads/${ID}`,
nested: { also: `/api/uploads/${ID}` },
other: "/api/uploads/not-a-uuid",
}),
).toEqual([ID]);
});
it("returns an empty list when nothing matches", () => {
expect(extractUploadIdsFromUnknown({ text: "no files" })).toEqual([]);
});
});