mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-09-09 22:31:10 +00:00
test(web): cover the saves reported in #1425
Pin the three content shapes from the issue - a markdown H1, a YAML frontmatter title block, and a title line followed by prose - plus repairing a card by pinning metadata.title over a null or paraphrased title.
This commit is contained in:
parent
53c005f776
commit
e62ef1a40b
1 changed files with 51 additions and 0 deletions
|
|
@ -176,3 +176,54 @@ describe("deriving a title from content", () => {
|
|||
expect(fromContent("Just one line")).toBe("Just one line")
|
||||
})
|
||||
})
|
||||
|
||||
describe("issue #1425 saves", () => {
|
||||
const cases = [
|
||||
[
|
||||
"markdown H1",
|
||||
"# Kubernetes upgrade plan\n\nWe are moving the cluster to 1.31.",
|
||||
"Kubernetes upgrade plan",
|
||||
],
|
||||
[
|
||||
"YAML frontmatter",
|
||||
"---\ntitle: Postgres pooling decision\ndate: 2026-08-07\n---\n\nWe moved to pgbouncer.",
|
||||
"Postgres pooling decision",
|
||||
],
|
||||
[
|
||||
"title line then blank line then prose",
|
||||
"Vendor security review\n\nThey passed SOC2 but the DPA needs redlines.",
|
||||
"Vendor security review",
|
||||
],
|
||||
] as const
|
||||
|
||||
for (const [label, content, expected] of cases) {
|
||||
it(`${label} no longer reads as untitled`, () => {
|
||||
const doc = {
|
||||
title: null,
|
||||
content,
|
||||
metadata: { sm_source: "supermemory-mcp" },
|
||||
}
|
||||
expect(resolveDocumentTitle(doc)).toBe(expected)
|
||||
})
|
||||
}
|
||||
|
||||
it("a pinned title repairs a card without re-saving", () => {
|
||||
expect(
|
||||
resolveDocumentTitle({
|
||||
title: null,
|
||||
content: cases[0][1],
|
||||
metadata: { sm_source: "supermemory-mcp", title: "My chosen title" },
|
||||
}),
|
||||
).toBe("My chosen title")
|
||||
})
|
||||
|
||||
it("a pinned title beats an LLM paraphrase", () => {
|
||||
expect(
|
||||
resolveDocumentTitle({
|
||||
title: "Notes About Upgrading Some Infrastructure",
|
||||
content: cases[0][1],
|
||||
metadata: { title: "Kubernetes upgrade plan" },
|
||||
}),
|
||||
).toBe("Kubernetes upgrade plan")
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue