19 lines
682 B
TypeScript
19 lines
682 B
TypeScript
import { helpContextForPathname } from "../src/utils/helpContext";
|
|
|
|
function assertEqual(actual: string, expected: string, message: string): void {
|
|
if (actual !== expected) throw new Error(`${message}: expected ${expected}, got ${actual}`);
|
|
}
|
|
|
|
assertEqual(helpContextForPathname("/files").id, "files.list", "Files context");
|
|
assertEqual(helpContextForPathname("/mail").id, "mail.list", "Mail context");
|
|
assertEqual(
|
|
helpContextForPathname("/settings", "?section=mail-profiles").id,
|
|
"mail.profiles",
|
|
"Mail profile settings context"
|
|
);
|
|
assertEqual(
|
|
helpContextForPathname("/campaigns/campaign-1/attachments").id,
|
|
"campaign.attachments",
|
|
"Campaign attachment context"
|
|
);
|