feat: conversations on the left, the transcript on the right (#6)
This commit was merged in pull request #6.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
ASSISTANT_MARKER,
|
||||
ASSISTANT_LABEL,
|
||||
STREAMING_CURSOR,
|
||||
USER_MARKER,
|
||||
USER_LABEL,
|
||||
buildThreadMarkdown,
|
||||
previewText,
|
||||
quote,
|
||||
@@ -46,16 +46,26 @@ describe("buildThreadMarkdown", () => {
|
||||
expect(markdown).toContain("4");
|
||||
});
|
||||
|
||||
it("marks each speaker with a role icon", () => {
|
||||
it("labels each speaker, in order", () => {
|
||||
const markdown = buildThreadMarkdown([
|
||||
message({ role: "user", text: "q" }),
|
||||
message({ role: "assistant", text: "a" }),
|
||||
]);
|
||||
|
||||
expect(markdown).toContain(USER_MARKER);
|
||||
expect(markdown).toContain(ASSISTANT_MARKER);
|
||||
// The user marker must not leak onto the answer or vice versa.
|
||||
expect(markdown.indexOf(USER_MARKER)).toBeLessThan(markdown.indexOf(ASSISTANT_MARKER));
|
||||
expect(markdown).toContain(`**${USER_LABEL}**`);
|
||||
expect(markdown).toContain(`**${ASSISTANT_LABEL}**`);
|
||||
expect(markdown.indexOf(USER_LABEL)).toBeLessThan(markdown.indexOf(ASSISTANT_LABEL));
|
||||
});
|
||||
|
||||
it("renders no images, because markdown cannot resolve them", () => {
|
||||
// Images render block-level and centred at up to 200px (`MdImage.qml`), and
|
||||
// every candidate icon source fails. Keep the transcript text-only.
|
||||
const markdown = buildThreadMarkdown([
|
||||
message({ role: "user", text: "q" }),
|
||||
message({ role: "assistant", text: "a" }),
|
||||
]);
|
||||
|
||||
expect(markdown).not.toContain("![");
|
||||
});
|
||||
|
||||
it("keeps the conversation in order", () => {
|
||||
|
||||
Reference in New Issue
Block a user