test: remove all test files for a clean restart (task 0003)
Temporary: clear the entire test suite (unit, subprocess, the shared helper, and the parser-integration placeholder) so the tests can be rebuilt from scratch. Fixtures and the test tooling (bunfig, report script) are kept. Note: `bun test` now errors on an empty suite, so the flake's tests check is red until tests return.
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
import { describe, test } from "bun:test";
|
||||
|
||||
describe("parser — integration", () => {
|
||||
test.todo("parses the primary fixture into the complete Document AST");
|
||||
test.todo("extracts every annotation type from the primary fixture");
|
||||
test.todo("extracts an annotation from inside the fixture's blockquote");
|
||||
test.todo("normalises the fixture's non-canonical unit (tablespoons -> tbsp)");
|
||||
});
|
||||
@@ -1,89 +0,0 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
|
||||
import { parse } from "./parse.ts";
|
||||
|
||||
describe("parser", () => {
|
||||
describe("frontmatter", () => {
|
||||
test("parses frontmatter fields as-is", () => {
|
||||
const source =
|
||||
"---\ntitle: Classic Pancakes\nservings: 4\ntags: [breakfast, quick]\n---\n\n# Classic Pancakes";
|
||||
|
||||
const result = parse(source);
|
||||
|
||||
expect(result.frontmatter).toEqual({
|
||||
title: "Classic Pancakes",
|
||||
servings: 4,
|
||||
tags: ["breakfast", "quick"],
|
||||
});
|
||||
});
|
||||
test("returns an empty object for empty frontmatter", () => {
|
||||
const source = "---\n---\n\n# Title";
|
||||
|
||||
const result = parse(source);
|
||||
|
||||
expect(result.frontmatter).toEqual({});
|
||||
expect(result.blocks).toContainEqual({
|
||||
type: "heading",
|
||||
level: 1,
|
||||
children: [{ type: "text", value: "Title" }],
|
||||
});
|
||||
expect(result.diagnostics).toEqual([]);
|
||||
});
|
||||
test("returns an empty object when there is no frontmatter", () => {
|
||||
const result = parse("# Title");
|
||||
|
||||
expect(result.frontmatter).toEqual({});
|
||||
expect(result.diagnostics).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("blocks", () => {
|
||||
test("parses headings at every level (1-6)", () => {
|
||||
const source = "# H1\n\n## H2\n\n### H3\n\n#### H4\n\n##### H5\n\n###### H6";
|
||||
|
||||
const result = parse(source);
|
||||
|
||||
expect(result).toEqual({
|
||||
frontmatter: {},
|
||||
blocks: [
|
||||
{ type: "heading", level: 1, children: [{ type: "text", value: "H1" }] },
|
||||
{ type: "heading", level: 2, children: [{ type: "text", value: "H2" }] },
|
||||
{ type: "heading", level: 3, children: [{ type: "text", value: "H3" }] },
|
||||
{ type: "heading", level: 4, children: [{ type: "text", value: "H4" }] },
|
||||
{ type: "heading", level: 5, children: [{ type: "text", value: "H5" }] },
|
||||
{ type: "heading", level: 6, children: [{ type: "text", value: "H6" }] },
|
||||
],
|
||||
diagnostics: [],
|
||||
});
|
||||
});
|
||||
test("keeps blocks flat and in document order (a heading is a sibling of the following paragraph)", () => {
|
||||
const result = parse("# Batter\n\nSift the flour into a bowl.");
|
||||
|
||||
expect(result).toEqual({
|
||||
frontmatter: {},
|
||||
blocks: [
|
||||
{ type: "heading", level: 1, children: [{ type: "text", value: "Batter" }] },
|
||||
{
|
||||
type: "paragraph",
|
||||
children: [{ type: "text", value: "Sift the flour into a bowl." }],
|
||||
},
|
||||
],
|
||||
diagnostics: [],
|
||||
});
|
||||
});
|
||||
test("parses paragraphs with typed inline nodes", () => {
|
||||
const result = parse("Hello world");
|
||||
|
||||
expect(result).toEqual({
|
||||
frontmatter: {},
|
||||
blocks: [
|
||||
{
|
||||
type: "paragraph",
|
||||
children: [{ type: "text", value: "Hello world" }],
|
||||
},
|
||||
],
|
||||
diagnostics: [],
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user