Skip to content
Open
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
14 changes: 4 additions & 10 deletions apps/desktop/src/lib/job_runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,16 @@ const mockWorkspace: RehearsalWorkspace = {
workspaceVersion: 1
};

const mockSongsById = new Map<string, SongRehearsalPack>();
const mockSongsById = new Map<string, SongRehearsalPack>(
mockWorkspace.songs.map(song => [song.id, song])
);

type MockListener = (event: { payload: unknown }) => void;
const mockListeners = new Set<MockListener>();

/** Documented. */
function getMockSong(jobId: string): SongRehearsalPack | undefined {
const cachedPack = mockSongsById.get(jobId);
if (cachedPack) {
return cachedPack;
}
const pack = mockWorkspace.songs.find(song => song.id === jobId);
if (pack) {
mockSongsById.set(jobId, pack);
}
return pack;
return mockSongsById.get(jobId);
}

/**
Expand Down