Initial human archive app
Some checks failed
Build and publish Docker image / docker (push) Failing after 2m33s
Some checks failed
Build and publish Docker image / docker (push) Failing after 2m33s
This commit is contained in:
33
src/lib/moderation.test.ts
Normal file
33
src/lib/moderation.test.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { validateSources } from "@/lib/moderation";
|
||||
|
||||
describe("validateSources", () => {
|
||||
it("requires at least one source", () => {
|
||||
expect(validateSources([])).toContain("missing_sources");
|
||||
});
|
||||
|
||||
it("requires a valid URL and license", () => {
|
||||
expect(
|
||||
validateSources([
|
||||
{
|
||||
title: "Archive",
|
||||
url: "not-a-url",
|
||||
language: "DE",
|
||||
},
|
||||
]),
|
||||
).toEqual(expect.arrayContaining(["source_invalid_url", "source_missing_license"]));
|
||||
});
|
||||
|
||||
it("accepts sourced material with licensing metadata", () => {
|
||||
expect(
|
||||
validateSources([
|
||||
{
|
||||
title: "Public record",
|
||||
url: "https://example.org/source",
|
||||
language: "EN",
|
||||
license: "CC BY 4.0",
|
||||
},
|
||||
]),
|
||||
).toEqual([]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user