Skip to content

Commit

Permalink
no longer need variable for title in heading tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-preston committed Jul 18, 2024
1 parent 3c911fb commit 4a9027b
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions articles/_build/heading.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ import type { MarkdownItState } from "./markdownIt.ts";
import { testEnvironment, testMarkdownIt } from "./testing.ts";
import { tokenPipeline } from "./tokenPipeline.ts";

let testTitle = "";

const pipeline = (state: MarkdownItState) => {
state.tokens = tokenPipeline(state)
.andThen(headingTitle)
.andThen(headingDate)
.result();
testTitle = extractedTitle();
};

Deno.test("It extracts title from markdown", () => {
Expand All @@ -24,7 +21,7 @@ Deno.test("It extracts title from markdown", () => {
].join("\n");
const markdownIt = testMarkdownIt(pipeline, []);
markdownIt.render(testMarkdown, testEnvironment());
assertEquals(testTitle, "The Title");
assertEquals(extractedTitle(), "The Title");
});

Deno.test("It puts the title & date in a header", () => {
Expand Down

0 comments on commit 4a9027b

Please sign in to comment.