fix: update test fixtures for branded types and required frontmatter title

This commit is contained in:
saberzero1 2026-04-03 16:56:49 +02:00
parent 8ac98c47e1
commit 506dc36521
No known key found for this signature in database
2 changed files with 5 additions and 4 deletions

View file

@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";
import path from "node:path";
import fs from "node:fs/promises";
import { tmpdir } from "node:os";
import type { FullSlug, FilePath } from "@quartz-community/types";
import { ExampleEmitter } from "../src/emitter";
import { createCtx, createProcessedContent } from "./helpers";
@ -13,8 +14,8 @@ describe("ExampleEmitter", () => {
const content = [
createProcessedContent({
slug: "hello-world",
filePath: "notes/hello-world.md",
slug: "hello-world" as FullSlug,
filePath: "notes/hello-world.md" as FilePath,
frontmatter: { title: "Hello", tags: ["docs"] },
}),
];

View file

@ -6,7 +6,7 @@ describe("ExampleFilter", () => {
it("filters drafts by default", () => {
const ctx = createCtx();
const filter = ExampleFilter();
const content = createProcessedContent({ frontmatter: { draft: true } });
const content = createProcessedContent({ frontmatter: { title: "Test", draft: true } });
expect(filter.shouldPublish(ctx, content)).toBe(false);
});
@ -14,7 +14,7 @@ describe("ExampleFilter", () => {
it("allows drafts when configured", () => {
const ctx = createCtx();
const filter = ExampleFilter({ allowDrafts: true });
const content = createProcessedContent({ frontmatter: { draft: true } });
const content = createProcessedContent({ frontmatter: { title: "Test", draft: true } });
expect(filter.shouldPublish(ctx, content)).toBe(true);
});