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 --> |
||
|---|---|---|
| .. | ||
| activityMock.ts | ||
| appleMdm.ts | ||
| axiosError.ts | ||
| certificatesMock.ts | ||
| commandMock.ts | ||
| commonMock.ts | ||
| configMock.ts | ||
| deviceUserMock.ts | ||
| fileMock.js | ||
| hostMock.ts | ||
| idpMock.ts | ||
| labelsMock.ts | ||
| licenseMock.ts | ||
| macAdminsMock.ts | ||
| mdmMock.ts | ||
| operatingSystemsMock.ts | ||
| osqueryTableMock.ts | ||
| policyMock.ts | ||
| queryMock.ts | ||
| queryReportMock.ts | ||
| README.md | ||
| scheduleableQueryMock.ts | ||
| scriptMock.ts | ||
| setupExperienceMock.ts | ||
| softwareMock.ts | ||
| teamMock.ts | ||
| userMock.ts | ||
| vulnerabilitiesMock.ts | ||
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 usage -Example
- Custom mocks usage -Global handlers vs. inline handlers -Examples
- Related links
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.
Related links
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.