diff --git a/src/lib/components/coreuithemeprovider/CoreUiThemeProvider.tsx b/src/lib/components/coreuithemeprovider/CoreUiThemeProvider.tsx index b7ff7a537f..6526e2522f 100644 --- a/src/lib/components/coreuithemeprovider/CoreUiThemeProvider.tsx +++ b/src/lib/components/coreuithemeprovider/CoreUiThemeProvider.tsx @@ -7,8 +7,11 @@ import { space, fontSize } from '../../style/theme'; */ type Theme = { statusHealthy: string; + statusHealthyRGB: string; statusWarning: string; + statusWarningRGB: string; statusCritical: string; + statusCriticalRGB: string; selectedActive: string; highlight: string; border: string; diff --git a/src/lib/components/toast/useMutationsHandler.test.tsx b/src/lib/components/toast/useMutationsHandler.test.tsx index efc55a377f..5fb5d6eff3 100644 --- a/src/lib/components/toast/useMutationsHandler.test.tsx +++ b/src/lib/components/toast/useMutationsHandler.test.tsx @@ -11,13 +11,24 @@ const mockUseToast = useToast as jest.MockedFunction; describe('useMutationsHandler', () => { const mainMutation = { mutation: { - isLoading: false, - isSuccess: true, + context: undefined, + data: [], + failureCount: 0, + error: null, isError: false, isIdle: false, + isLoading: false, + isPaused: false, + isSuccess: true, + mutate: jest.fn(), + mutateAsync: jest.fn(), + reset: jest.fn(), + status: 'success', + variables: undefined, }, name: 'mutation1', - } as MutationConfig; + } as MutationConfig; + const dependantMutations = [ { mutation: { @@ -38,7 +49,7 @@ describe('useMutationsHandler', () => { name: 'mutation3', isPrimary: false, }, - ] as MutationConfig[]; + ] as MutationConfig[]; const messageDescriptionBuilder = jest.fn(() => 'message'); @@ -108,7 +119,7 @@ describe('useMutationsHandler', () => { }, name: 'mutation4', }, - ] as MutationConfig[]; + ] as MutationConfig[]; const { waitFor } = renderHook(() => useMutationsHandler({ diff --git a/src/lib/components/toast/useMutationsHandler.ts b/src/lib/components/toast/useMutationsHandler.ts index c74dbbdfc4..542551fe75 100644 --- a/src/lib/components/toast/useMutationsHandler.ts +++ b/src/lib/components/toast/useMutationsHandler.ts @@ -2,35 +2,35 @@ import { ReactNode, useCallback, useEffect } from 'react'; import { UseMutationResult } from 'react-query'; import { useToast } from './ToastProvider'; -export type MutationConfig = { - mutation: UseMutationResult; +export type MutationConfig = { + mutation: UseMutationResult; name: string; }; -type DescriptionBuilder = { - data?: Data; +type DescriptionBuilder = { + data?: unknown; error?: unknown; name: string; }; -type MutationsHandlerProps = { - mainMutation: MutationConfig; - dependantMutations?: MutationConfig[]; +type MutationsHandlerProps = { + mainMutation: MutationConfig; + dependantMutations?: MutationConfig[]; messageDescriptionBuilder: ( - successMutations: DescriptionBuilder[], - errorMutations: DescriptionBuilder[], + successMutations: DescriptionBuilder[], + errorMutations: DescriptionBuilder[], ) => ReactNode; toastStyles?: React.CSSProperties; onMainMutationSuccess?: () => void; }; -export const useMutationsHandler = ({ +export const useMutationsHandler = ({ mainMutation, dependantMutations, messageDescriptionBuilder, toastStyles, onMainMutationSuccess, -}: MutationsHandlerProps) => { +}: MutationsHandlerProps) => { const { showToast } = useToast(); const mutations = [ mainMutation,