import { trimIndentation } from "@triliumnext/commons"; import { describe, expect, it } from "vitest"; import { buildNote, buildNotes } from "../../test/becca_easy_mocking"; import note_map from "./note_map"; describe("Note map service", () => { it("correctly identifies backlinks", () => { const note = buildNote({ id: "dUtgloZIckax", title: "Backlink text" }); buildNotes([ { title: "First", id: "first", "~internalLink": "dUtgloZIckax", content: trimIndentation`\

The quick brownie

Backlink text

` }, { title: "Second", id: "second", "~internalLink": "dUtgloZIckax", content: trimIndentation`\

Backlink text

First

Second

` } ]); const backlinksResponse = note_map.getBacklinks({ params: { noteId: note.noteId } } as any); expect(backlinksResponse).toMatchObject([ { excerpts: [ trimIndentation`\ ` ], noteId: "first", }, { excerpts: [ trimIndentation`\ ` ], noteId: "second" } ]); }); });