fleet/frontend/__mocks__
Ian Littman da6cfd8e9f
Show configuration profile name and more fine-grained status (#42126)
Resolves #40177 and subissues.

# Checklist for submitter

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.

- [x] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements), JS
inline code is prevented especially for url redirects, and untrusted
data interpolated into shell scripts/commands is validated against shell
metacharacters.

## Testing

- [x] Added/updated automated tests
- [x] Where appropriate, [automated tests simulate multiple hosts and
test for host
isolation](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/reference/patterns-backend.md#unit-testing)
(updates to one hosts's records do not affect another)

- [sorta] QA'd all new/changed functionality manually

## Database migrations

- [x] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [x] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [x] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Profile names are now displayed alongside mobile device management
commands for installing or removing profiles. These names are visible in
command details modals and within device activity timelines.
* Added "NotNow" status for deferred profile commands, providing
improved transparency into which profiles are being managed and the
current status of profile installation or removal operations.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-09 12:46:11 -05:00
..
activityMock.ts API only users show a different avatar in the activity feed (#30512) 2025-07-07 10:45:51 -04:00
appleMdm.ts UI – Add VPP features for iPadOS and iOS (#20755) 2024-07-30 10:14:25 -07:00
axiosError.ts Feat UI update macos windows setup (#12744) 2023-07-17 15:51:40 +01:00
certificatesMock.ts Create, list, delete Android certificates from the UI (#37314) 2025-12-16 15:39:07 -08:00
commandMock.ts Show configuration profile name and more fine-grained status (#42126) 2026-04-09 12:46:11 -05:00
commonMock.ts UI: Windows setup experience > install software (#32934) 2025-09-16 10:12:25 -07:00
configMock.ts ACME MDM -> main (#42926) 2026-04-02 15:56:31 -05:00
deviceUserMock.ts Stop setup experience on software install failure (#34173) 2025-10-17 08:38:53 -05:00
fileMock.js add prettier and have it format all fleet application code (#625) 2021-04-12 14:32:25 +01:00
hostMock.ts Use new multiplatform keys on the front end (#41763) 2026-03-30 08:56:21 -05:00
idpMock.ts add new idp section on integrations page and show the users idp connection with fleet (#27566) 2025-03-28 11:23:07 +00:00
labelsMock.ts API + auth + UI changes for team labels (#37208) 2025-12-29 21:28:45 -06:00
licenseMock.ts UI: DUP only check for setup experience software on Fleet Premium (#33006) 2025-09-15 15:26:23 -07:00
macAdminsMock.ts UI for bootstrap package flows (#11288) 2023-04-27 16:10:41 +01:00
mdmMock.ts Use new multiplatform keys on the front end (#41763) 2026-03-30 08:56:21 -05:00
operatingSystemsMock.ts Fleet UI: Add 10 per page to install software setup (#40505) 2026-02-27 10:29:34 -05:00
osqueryTableMock.ts Fleet Frontend: Create integration tests QuerySidePanel.tests.tsx (#12179) 2023-06-07 12:01:59 -04:00
policyMock.ts Feat/31914 patch policy (#41518) 2026-03-13 16:47:09 -04:00
queryMock.ts Hide Add Query button on Host Details for unsupported host platforms (#37912) 2026-01-06 15:30:01 -03:00
queryReportMock.ts Added server_settings.query_report_cap (#19692) 2024-06-14 12:24:01 -03:00
README.md Organize contributor docs and establish ADR process and template (#29101) 2025-05-17 15:03:52 -05:00
scheduleableQueryMock.ts Fleet UI: Can run a live query on an edited (but not saved) existing query (#16282) 2024-01-25 13:12:59 -05:00
scriptMock.ts UI: Batch script run detail page (#32333) 2025-08-29 09:37:05 -06:00
setupExperienceMock.ts disabled manual agent install checkbox when setup experience software and run script is already added (#28679) 2025-04-30 16:22:24 +01:00
softwareMock.ts ui impl for labels include all (#41836) 2026-03-18 15:16:25 -04:00
teamMock.ts refactor activity items and add query name to live_query activity type (#8740) 2022-11-17 14:25:40 +00:00
userMock.ts update auth token storage (#40504) 2026-02-26 17:05:13 +00:00
vulnerabilitiesMock.ts Fleet UI: Add Linux kernel vulns card/table (#31840) 2025-08-14 09:30:49 -04:00

Frontend mocks

Each __mocks___/*Mock.ts file contains one or more default mock objects and their corresponding helper function to partially override the default mock creating custom mocks.

Table of contents

Default mocks

Default mocks are simple to work with objects. We limit the default mock to a single object that can be modified with the helper function as needed using overrides.

The default mock object is returned by calling the helper function with no arguments.

Example

A single default activity is defined in __mocks__/activityMock.ts as:

const DEFAULT_ACTIVITY_MOCK: IActivity = {
  created_at: "2022-11-03T17:22:14Z",
  id: 1,
  actor_full_name: "Test",
  actor_id: 1,
  actor_gravatar: "",
  actor_email: "test@example.com",
  type: ActivityType.EditedAgentOptions,
};

To return this default object, call its helper function createActivityMock() with no arguments.

Custom mocks

Custom mocks are useful when we need a mock object with specific data.

Use the helper function with arguments to override the default mock data with the specific data you need.

Example

createMockActivity({ id: 2, actor_full_name: "Gabe" }) will return modifications to the DEFAULT_ACTIVITY_MOCK to override the id and actor_full_name keys only.

Check out the frontend test directory for information about our unit and integration testing layers. We use default mocks and custom mocks when mocking server requests.

Follow this guide to run tests locally.

Visit the frontend overview of Fleet UI testing for more information on our testing strategy, philosophies, and tools.