1
0
silverbullet/plugs/index/snippet.test.ts
Zef Hemel 0313565610
Complete redo of content indexing and querying (#517)
Complete redo of data store
Introduces live queries and live templates
2023-10-03 14:16:33 +02:00

18 lines
496 B
TypeScript

import { assertEquals } from "../../test_deps.ts";
import { extractSnippet } from "./page_links.ts";
Deno.test("Snippet extraction", () => {
const sample1 = `This is a test
and a [[new]] line that runs super duper duper duper duper duper long
[[SETTINGS]]
super`;
assertEquals(
extractSnippet(sample1, sample1.indexOf("[[new]]")),
"and a [[new]] line that runs sup",
);
assertEquals(
extractSnippet(sample1, sample1.indexOf("[[SETTINGS]]")),
"[[SETTINGS]]",
);
});