fleet/frontend/__mocks__/labelsMock.ts
Gabriel Hernandez 2fc4e520b8
add ability to create manual labels (#18303)
relates to #17031

Adds functionality to create manual labels in fleet.

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

---------

Co-authored-by: Martin Angers <martin.n.angers@gmail.com>
2024-04-16 17:22:08 +01:00

31 lines
855 B
TypeScript

import { ILabel } from "interfaces/label";
import { IGetLabelResonse } from "services/entities/labels";
const DEFAULT_LABEL_MOCK: ILabel = {
created_at: "2024-04-12T13:32:00Z",
updated_at: "2024-04-12T14:27:07Z",
id: 1,
name: "test label",
description: "test label description",
query: "SELECT 1;",
platform: "darwin",
label_type: "regular",
label_membership_type: "dynamic",
display_text: "test macsss",
count: 0,
host_ids: null,
};
export const createMockLabel = (overrides?: Partial<ILabel>): ILabel => {
return { ...DEFAULT_LABEL_MOCK, ...overrides };
};
const DEFAULT_GET_LABEL_RESPONSE_MOCK: IGetLabelResonse = {
label: createMockLabel(),
};
export const createMockGetLabelResponse = (
overrides?: Partial<IGetLabelResonse>
): IGetLabelResonse => {
return { ...DEFAULT_GET_LABEL_RESPONSE_MOCK, ...overrides };
};