**Related issue:** Resolves #45641 If some of the following don't apply, delete the relevant line. - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files) for more information. In other subtask. ## Testing - [x] Added/updated automated tests - [x] QA'd all new/changed functionality manually <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Added support for tracking and displaying “ran custom MDM command” activities across dashboard and host activity feeds. * Added custom MDM command detail modals with status-aware messaging, actor attribution, target host, and relative “time ago” updates. * Improved command name rendering by shortening long request types for cleaner display. * **Bug Fixes** * Enhanced command status handling for additional Apple and Windows status formats so icons and verbs display correctly. * **Tests** * Added coverage for custom MDM command rendering and command-status helper behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
30 lines
944 B
TypeScript
30 lines
944 B
TypeScript
import { getMdmCommandDisplayName } from "./activityHelpers";
|
|
|
|
describe("getMdmCommandDisplayName function", () => {
|
|
it("returns empty string for undefined", () => {
|
|
expect(getMdmCommandDisplayName(undefined)).toEqual("");
|
|
});
|
|
|
|
it("returns empty string for empty string", () => {
|
|
expect(getMdmCommandDisplayName("")).toEqual("");
|
|
});
|
|
|
|
it("returns the value as-is for a simple command name with no path separator", () => {
|
|
expect(getMdmCommandDisplayName("DeviceInformation")).toEqual(
|
|
"DeviceInformation"
|
|
);
|
|
});
|
|
|
|
it("truncates a multi-segment Windows OMA-URI path to the last segment", () => {
|
|
expect(
|
|
getMdmCommandDisplayName(
|
|
"./Device/Vendor/MSFT/DMClient/Provider/DEMO/EntDMID"
|
|
)
|
|
).toEqual(".../EntDMID");
|
|
});
|
|
|
|
it("handles a trailing slash by ignoring the empty final segment", () => {
|
|
expect(getMdmCommandDisplayName("./Vendor/MSFT/")).toEqual(".../MSFT");
|
|
});
|
|
});
|