function assertEqual(actual: unknown, expected: unknown): void { if (actual !== expected) throw new Error(`expected ${String(expected)}, got ${String(actual)}`); } function assertDeepEqual(actual: unknown, expected: unknown): void { const actualJson = JSON.stringify(actual); const expectedJson = JSON.stringify(expected); if (actualJson !== expectedJson) throw new Error(`expected ${expectedJson}, got ${actualJson}`); } import { mailboxDraftsLaunchPath, mailboxLaunchFolder, mailboxMessageLaunchPath, parseMailboxLaunch } from "../src/features/mail/mailboxLaunch"; assertDeepEqual( parseMailboxLaunch("?profile=profile-1&folder=INBOX%2FTeam&message=42"), { profileId: "profile-1", folder: "INBOX/Team", folderRole: null, messageUid: "42" } ); assertEqual( mailboxMessageLaunchPath("profile 1", { folder: "INBOX/Team", uid: "42" }), "/mail?profile=profile+1&folder=INBOX%2FTeam&message=42" ); assertEqual( mailboxDraftsLaunchPath("profile-1"), "/mail?profile=profile-1&folderRole=drafts" ); assertEqual( mailboxDraftsLaunchPath("profile-1", "Entwürfe"), "/mail?profile=profile-1&folder=Entw%C3%BCrfe" ); assertEqual( mailboxLaunchFolder(parseMailboxLaunch("?folderRole=drafts"), { imap: { folder_mappings: { drafts: "Entwürfe" } } }), "Entwürfe" ); console.log("mailbox launch tests passed");