Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions apps/desktop/src/lib/export.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,48 @@ describe("export generation", () => {
expect(lines[1]).toBe('verse,swing,Bass,\'=Cmaj7,"1, 2, 3",high,setup | simple');
});


it("generates chart summary JSON as exact string", () => {
const jsonStr = generateChartSummaryJson(mockSong);
const expected = JSON.stringify({
title: "Test",
headline: "Headline",
sections: [
{
label: "verse",
groove: "swing",
roles: [
{
name: "Bass",
chord: "=Cmaj7",
cue: "1, 2, 3",
priority: "high"
}
]
}
]
}, null, 2);
expect(jsonStr).toBe(expected);
});

it("generates chart summary JSON", () => {
const jsonStr = generateChartSummaryJson(mockSong);
const parsed = JSON.parse(jsonStr);
expect(parsed.title).toBe("Test");
expect(parsed.sections[0].roles[0].chord).toBe("=Cmaj7");
});


it("generates chart summary JSON when exportSummary is undefined", () => {
const mockSongNoExportSummary = {
...mockSong,
exportSummary: undefined
};
const jsonStr = generateChartSummaryJson(mockSongNoExportSummary);
const parsed = JSON.parse(jsonStr);
expect(parsed.headline).toBe("");
});

it("generates chart summary JSON when headline is missing", () => {
const mockSongNoHeadline: RehearsalSong = {
...mockSong,
Expand All @@ -143,6 +178,20 @@ describe("export generation", () => {
expect(parsed.headline).toBe("");
});


it("creates a metadata handoff artifact without workspaceId or workspaceTitle", () => {
const json = generateMetadataHandoffJson(mockSong, {
createdAt: "2026-06-15T08:30:00.000Z"
});
const parsed = JSON.parse(json);

expect(parsed.workspace).toEqual({
id: "test",
title: "Test",
workspaceVersion: 1
});
});

it("generates a metadata-only local handoff without source paths or transcription data", () => {
const sourceBootstrap: ProjectBootstrapSummary = {
projectId: "project-1",
Expand Down
Loading