mirror of
https://github.com/quartz-community/article-title.git
synced 2026-07-22 02:50:30 +00:00
21 lines
725 B
TypeScript
21 lines
725 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { ExampleFilter } from "../src/filter";
|
|
import { createCtx, createProcessedContent } from "./helpers";
|
|
|
|
describe("ExampleFilter", () => {
|
|
it("filters drafts by default", () => {
|
|
const ctx = createCtx();
|
|
const filter = ExampleFilter();
|
|
const content = createProcessedContent({ frontmatter: { draft: true } });
|
|
|
|
expect(filter.shouldPublish(ctx, content)).toBe(false);
|
|
});
|
|
|
|
it("allows drafts when configured", () => {
|
|
const ctx = createCtx();
|
|
const filter = ExampleFilter({ allowDrafts: true });
|
|
const content = createProcessedContent({ frontmatter: { draft: true } });
|
|
|
|
expect(filter.shouldPublish(ctx, content)).toBe(true);
|
|
});
|
|
});
|