⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
import { describe, expect, it } from "vite-plus/test";
import { mapComments } from "./comments.js";
import { createJiraHtmlToMarkdown } from "./html.js";
const toMarkdown = createJiraHtmlToMarkdown("https://jira.example.com");
describe("mapComments", () => {
it("orders comments oldest first with Markdown bodies and authors", () => {
expect(
mapComments(
[
{
id: "2",
author: {
displayName: "Grace Hopper",
emailAddress: "[email protected]",
},
body: { type: "doc" },
renderedBody: "<p>Second <b>reply</b></p>",
created: "2024-03-02T09:00:00.000+0000",
},
{
id: "1",
author: { displayName: "Ada Lovelace" },
renderedBody: "<p>First</p>",
created: "2024-03-01T09:00:00.000+0000",
},
{
id: "3",
author: null,
body: " Wiki *text* ",
created: "2024-03-03T09:00:00.000+0000",
},
{
id: "4",
author: { emailAddress: "[email protected]" },
renderedBody: "<p></p>",
created: "2024-03-04T09:00:00.000+0000",
},
],
toMarkdown,
),
).toEqual([
{
author: { name: "Ada Lovelace" },
body: "First",
createdAt: "2024-03-01T09:00:00.000Z",
},
{
author: { name: "Grace Hopper", email: "[email protected]" },
body: "Second **reply**",
createdAt: "2024-03-02T09:00:00.000Z",
},
{
author: { name: "Jira user" },
body: "Wiki *text*",
createdAt: "2024-03-03T09:00:00.000Z",
},
]);
});
it("uses the email as the name when there is no display name", () => {
expect(
mapComments(
[
{
author: { emailAddress: "[email protected]" },
renderedBody: "<p>Hi</p>",
},
],
toMarkdown,
),
).toEqual([
{
author: { name: "[email protected]", email: "[email protected]" },
body: "Hi",
},
]);
});
});