Guest publishes remain share-by-link but stay out of the catalog and sitemap, and their pages send noindex until claimed. The published-rule view now uses heading and list markup matching Markdown export, and top banners sit below the header so Share is not covered. Co-authored-by: Cursor <cursoragent@cursor.com>
37 lines
954 B
TypeScript
37 lines
954 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
LISTED_PUBLISHED_RULE_WHERE,
|
|
isListedPublishedRule,
|
|
} from "../../lib/publishedRuleAccess";
|
|
|
|
describe("isListedPublishedRule", () => {
|
|
it("lists owned rules", () => {
|
|
expect(
|
|
isListedPublishedRule({ userId: "user-1", claimTokenHash: null }),
|
|
).toBe(true);
|
|
});
|
|
|
|
it("lists ownerless rows that are not waiting on a guest claim", () => {
|
|
expect(isListedPublishedRule({ userId: null, claimTokenHash: null })).toBe(
|
|
true,
|
|
);
|
|
});
|
|
|
|
it("keeps guest-claim rows unlisted", () => {
|
|
expect(
|
|
isListedPublishedRule({
|
|
userId: null,
|
|
claimTokenHash: "claim-hash",
|
|
}),
|
|
).toBe(false);
|
|
});
|
|
});
|
|
|
|
describe("LISTED_PUBLISHED_RULE_WHERE", () => {
|
|
it("matches owned rows or rows with no claim token", () => {
|
|
expect(LISTED_PUBLISHED_RULE_WHERE).toEqual({
|
|
OR: [{ userId: { not: null } }, { claimTokenHash: null }],
|
|
});
|
|
});
|
|
});
|