Skip to content

Commit 79fe802

Browse files
committed
test(chatbot): ajout de tests pour extractMainContent
1 parent b5cc3be commit 79fe802

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

tests/unit/core/chatbot/parsers/extractMainContent.spec.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,15 @@ on multiples lines
4040
## First
4141
- item A
4242
Some content A
43+
1. [goto](Second)
4344
## Second
4445
Some content B`;
4546
const result = getMainContentInformations(markdown, 11, yaml);
4647

4748
expect(result.length).toBe(2);
4849
expect(result[0][0]).toBe("First");
4950
expect(result[0][1]).toEqual(["item A"]);
51+
expect(result[0][3]).toEqual([["goto", "Second", false, ""]]);
5052
expect(result[1][0]).toBe("Second");
5153
expect(result[1][1]).toEqual([]);
5254
});
@@ -134,4 +136,18 @@ Another line of text.`;
134136
expect(result3[0][2]).toEqual(["Some informative text here."]);
135137
expect(result3[0][2]).not.toContain("This is an H3 title");
136138
});
139+
140+
it("returns empty chatbotData if no response title exists", () => {
141+
const md = "Some intro\nContent continues\nTest";
142+
const result = getMainContentInformations(md, 0, yaml);
143+
expect(result).toEqual([
144+
[null, [], ["Some intro", "Content continues", "Test"], null],
145+
]);
146+
});
147+
148+
it("ignores structure-only titles based on isStructureTitle", () => {
149+
const md = "# Hidden\n### Actual\nVisible content";
150+
const result = getMainContentInformations(md, 0, yaml);
151+
expect(result).toEqual([["Actual", [], ["Visible content"], null]]);
152+
});
137153
});

0 commit comments

Comments
 (0)