fleet/frontend/__mocks__
Juan Fernandez b95d3cbfd7
Ability to set fleet desktop alternative browser host in org settings (#38409)
Resolves #33762 & #38094 

Added a new `alternative-browser-host` global config property for Fleet Desktop, if set, Fleet Desktop will use it over the `--fleet-desktop-alternative-browser-host` env variable to open any Fleet Desktop related links (i.e. My Device, etc).
2026-01-19 16:25:22 -04: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 add UI pagination to host mdm commands feed (#37453) 2025-12-19 08:52:30 -05:00
commonMock.ts UI: Windows setup experience > install software (#32934) 2025-09-16 10:12:25 -07:00
configMock.ts Ability to set fleet desktop alternative browser host in org settings (#38409) 2026-01-19 16:25:22 -04: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 33509 feature branch (#38038) 2026-01-08 16:37:46 -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 Update UI for command results in host activity feed (#37417) 2025-12-18 11:52:25 -06:00
operatingSystemsMock.ts Fleet UI: Add Linux kernel vulns card/table (#31840) 2025-08-14 09:30:49 -04:00
osqueryTableMock.ts Fleet Frontend: Create integration tests QuerySidePanel.tests.tsx (#12179) 2023-06-07 12:01:59 -04:00
policyMock.ts UI: Update conditional access on a per-policy basis (#28658) 2025-05-01 11:43:38 -07: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 Fleet UI: Ability to update android configuration + FE cleanups (#37065) 2025-12-15 09:26:33 -05: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 Fleet UI: Add update details modal (#31250) 2025-07-25 09:28:25 -04: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.