fleet/frontend/__mocks__
Gabriel Hernandez a292e704de
add startup assistant to the UI (#17731)
relates to #9147

add the setup assistant page to the UI. This includes:

- new setup assistant page
- uploaded profile and release device manually form
- preview for setup assistant flow

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Martin Angers <martin.n.angers@gmail.com>
2024-03-26 14:46:33 +00:00
..
activityMock.ts Add new activity types for login and user modifications (#9101) 2022-12-22 14:24:13 -06:00
appleMdm.ts Feat UI update macos windows setup (#12744) 2023-07-17 15:51:40 +01:00
axiosError.ts Feat UI update macos windows setup (#12744) 2023-07-17 15:51:40 +01:00
configMock.ts add startup assistant to the UI (#17731) 2024-03-26 14:46:33 +00:00
deviceUserMock.ts integration test device user page with mock and custom renderer (#8475) 2022-11-01 18:59:40 +00:00
fileMock.js add prettier and have it format all fleet application code (#625) 2021-04-12 14:32:25 +01:00
hostMock.ts update UI to react 18 (#17471) 2024-03-13 19:09:16 +00:00
licenseMock.ts integration test device user page with mock and custom renderer (#8475) 2022-11-01 18:59:40 +00:00
macAdminsMock.ts UI for bootstrap package flows (#11288) 2023-04-27 16:10:41 +01:00
mdmMock.ts Fix for mdm solution rollup to handle empty string for rollup correctly. (#17366) 2024-03-05 15:48:55 +00:00
operatingSystemsMock.ts add missing fields, restore legacy types for proper build (#16618) 2024-02-15 10:35:05 -07:00
osqueryTableMock.ts Fleet Frontend: Create integration tests QuerySidePanel.tests.tsx (#12179) 2023-06-07 12:01:59 -04:00
policyMock.ts Added tooltip to Policies page stating when policy counts were last updated. (#15784) 2024-01-03 07:47:43 -06:00
queryMock.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
queryReportMock.ts Fleet UI: Query report (table, buttons, api calls, etc) (#14325) 2023-10-09 13:38:34 -07:00
README.md Add new activity types for login and user modifications (#9101) 2022-12-22 14:24:13 -06: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 Queued scripts feature (#16300) 2024-01-29 11:37:54 -03:00
softwareMock.ts Add browser type to software titles UI and API (#15604) 2023-12-12 16:21:44 -06: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 integration test device user page with mock and custom renderer (#8475) 2022-11-01 18:59:40 +00:00
vulnerabilitiesMock.ts [unreleased bugs] Vuln details page: missing cards, incorrect link (#17495) 2024-03-08 10:53:02 -05: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.