import { describe, expect, it } from "vitest"; import { displayAuditAction } from "./auditAction"; // audit-log-readable-actions: events stored before mobile-api recorded readable codes carry the raw // "XController.method" name; the list shows them as the code mobile-api now derives for new events. describe("displayAuditAction", () => { it.each([ ["AdminPromotionController.changeStatus", "PROMOTION_CHANGE_STATUS"], ["AdminPromotionController.generateVouchers", "PROMOTION_GENERATE_VOUCHERS"], ["AdminKYCController.exportPDF", "KYC_EXPORT_PDF"], ["AdminTarget.update", "TARGET_UPDATE"], ["AdminController.save", "ADMIN_SAVE"], ])("derives the readable code for a legacy %s", (stored, shown) => { expect(displayAuditAction(stored)).toBe(shown); }); it.each(["MESSAGES_EXPORT", "MEMBER_PROFILE_EDIT", "PROMOTION_CHANGE_STATUS"])( "leaves an existing code %s unchanged", (code) => { expect(displayAuditAction(code)).toBe(code); }, ); it("passes through an empty or missing action", () => { expect(displayAuditAction("")).toBe(""); expect(displayAuditAction(undefined)).toBe(""); }); });