feat: added headers to links in local pages
This commit is contained in:
@@ -3,10 +3,27 @@ import assert from "node:assert/strict";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import http from "node:http";
|
||||
import { createServer, triggerEleventyBuild } from "../server.js";
|
||||
import { createServer, normalizeObsidianMarkdown, triggerEleventyBuild } from "../server.js";
|
||||
|
||||
const TEST_SECRET = "super-secret-test-token";
|
||||
|
||||
test("Obsidian normalization: preserves linked note header fragments", () => {
|
||||
const normalized = normalizeObsidianMarkdown(
|
||||
"See [[a note#header one]] and [[another note#Second Header|the other section]]."
|
||||
);
|
||||
|
||||
assert.match(
|
||||
normalized,
|
||||
/\[a note#header one\]\(\/posts\/a-note\/#header-one\)/,
|
||||
"A wikilink header must become a URL fragment on the linked note"
|
||||
);
|
||||
assert.match(
|
||||
normalized,
|
||||
/\[the other section\]\(\/posts\/another-note\/#second-header\)/,
|
||||
"Aliased wikilinks must retain their linked-note header fragment"
|
||||
);
|
||||
});
|
||||
|
||||
test("Ingestion API: rejects requests without proper Bearer token", async () => {
|
||||
const tmpDir = fs.mkdtempSync(path.join(process.cwd(), "test-tmp-site-"));
|
||||
const tmpPosts = fs.mkdtempSync(path.join(process.cwd(), "test-tmp-posts-"));
|
||||
|
||||
Reference in New Issue
Block a user