fleet/frontend/__mocks__
jacobshandling d9f7935fce
UI – Uninstall features for host details, install/uninstall actions, activity feed, misc other items (#21933)
## #21566 - Host details updates for Uninstall packages

details > software page. Full tasks outlined in the issue, [Figma
here](https://www.figma.com/design/ToQaK2yUJwDyzagTdrbOfX/%2320320-Uninstall-packages?node-id=5364-13173&m=dev)

**Updated install status tooltips:**

![install-status-tooltips](https://github.com/user-attachments/assets/9869c7d6-f953-4adc-9692-52f5dad9d81a)

**Uninstall action:**

![uninstall-action](https://github.com/user-attachments/assets/189d5755-556c-48ca-8824-08db14ec95d4)

**Update install details:**
![Screenshot 2024-09-09 at 1 12
58 PM](https://github.com/user-attachments/assets/f52b349b-9f01-49d4-b952-6efd60f29979)


## #21931 - updated specs for install/uninstall states

## #21568 - activity feed items for Uninstall
![Screenshot 2024-09-09 at 5 00
07 PM](https://github.com/user-attachments/assets/eb61949a-9f8d-4b9e-a437-2d31a6808f07)
![Screenshot 2024-09-09 at 5 42
52 PM](https://github.com/user-attachments/assets/a8c2de0e-27e3-4d2b-bf69-702ea7b72e48)
![Screenshot 2024-09-09 at 5 43
03 PM](https://github.com/user-attachments/assets/b6127ed3-6fcf-439e-aa3d-91038a025d92)

## #21567 - Uninstall details modal
![Screenshot 2024-09-10 at 7 42
18 PM](https://github.com/user-attachments/assets/a42e4e4a-eadd-4e75-84c5-c5f6a6230950)
_remaining TODO_:
  - [x] manually QA 'failed' states
- [x] determine where to source timestamp from for uninstall activities

- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
Co-authored-by: Victor Lyuboslavsky <victor@fleetdm.com>
2024-09-12 11:51:59 -04:00
..
activityMock.ts Add new activity types for login and user modifications (#9101) 2022-12-22 14:24:13 -06: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
configMock.ts Fleet UI: Add minimum version requirement information to Host Details page (#20505) 2024-07-25 16:33:36 -04:00
deviceUserMock.ts Update VPP UI to incorporate last_install API changes (#20704) 2024-07-24 14:32:59 -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 Update VPP UI to incorporate last_install API changes (#20704) 2024-07-24 14:32:59 -05:00
labelsMock.ts add ability to create manual labels (#18303) 2024-04-16 17:22:08 +01: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 UI – Policy software install automations (#21792) 2024-09-03 15:35:33 -07: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 Added server_settings.query_report_cap (#19692) 2024-06-14 12:24:01 -03: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 UI – Uninstall features for host details, install/uninstall actions, activity feed, misc other items (#21933) 2024-09-12 11:51:59 -04:00
softwareMock.ts UI – Uninstall features for host details, install/uninstall actions, activity feed, misc other items (#21933) 2024-09-12 11:51:59 -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 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.