4488 connect calendar tab to backend (#4624)
* create states and hooks * implement fetch more records * add empty state * update types * fix error * add fetchmoreloader and add scroll to container * fix visibility in calendarEventFragment * fix fetchMoreRecords * update TIMELINE_CALENDAR_EVENTS_DEFAULT_PAGE_SIZE * add test * modify empty state subtitle * replace entity by activityTargetableObject * create useCustomResolver hook * refactor * refactoring * use generic component * rename FetchMoreLoader * remove deprecated states and hooks * fix typing * update typing * update error message * renaming * improve typing * fix bug on contact creation from same company
This commit is contained in:
@ -1,37 +0,0 @@
|
||||
import { renderHook } from '@testing-library/react';
|
||||
|
||||
import { useEmailThreadStates } from '@/activities/emails/hooks/internal/useEmailThreadStates';
|
||||
|
||||
const mockScopeId = 'mockScopeId';
|
||||
const mockGetEmailThreadsPageState = jest.fn();
|
||||
|
||||
jest.mock(
|
||||
'@/ui/utilities/recoil-scope/scopes-internal/hooks/useAvailableScopeId',
|
||||
() => ({
|
||||
useAvailableScopeIdOrThrow: () => mockScopeId,
|
||||
}),
|
||||
);
|
||||
|
||||
jest.mock(
|
||||
'@/ui/utilities/state/component-state/utils/extractComponentState',
|
||||
() => ({
|
||||
extractComponentState: () => mockGetEmailThreadsPageState,
|
||||
}),
|
||||
);
|
||||
|
||||
describe('useEmailThreadStates hook', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it('returns the correct scopeId and getEmailThreadsPageState', () => {
|
||||
const { result } = renderHook(() =>
|
||||
useEmailThreadStates({ emailThreadScopeId: 'mockEmailThreadScopeId' }),
|
||||
);
|
||||
|
||||
expect(result.current.scopeId).toBe(mockScopeId);
|
||||
expect(result.current.emailThreadsPageState).toBe(
|
||||
mockGetEmailThreadsPageState,
|
||||
);
|
||||
});
|
||||
});
|
||||
@ -1,25 +0,0 @@
|
||||
import { emailThreadsPageComponentState } from '@/activities/emails/states/emailThreadsPageComponentState';
|
||||
import { TabListScopeInternalContext } from '@/ui/layout/tab/scopes/scope-internal-context/TabListScopeInternalContext';
|
||||
import { useAvailableScopeIdOrThrow } from '@/ui/utilities/recoil-scope/scopes-internal/hooks/useAvailableScopeId';
|
||||
import { extractComponentState } from '@/ui/utilities/state/component-state/utils/extractComponentState';
|
||||
|
||||
type useEmailThreadStatesProps = {
|
||||
emailThreadScopeId?: string;
|
||||
};
|
||||
|
||||
export const useEmailThreadStates = ({
|
||||
emailThreadScopeId,
|
||||
}: useEmailThreadStatesProps) => {
|
||||
const scopeId = useAvailableScopeIdOrThrow(
|
||||
TabListScopeInternalContext,
|
||||
emailThreadScopeId,
|
||||
);
|
||||
|
||||
return {
|
||||
scopeId,
|
||||
emailThreadsPageState: extractComponentState(
|
||||
emailThreadsPageComponentState,
|
||||
scopeId,
|
||||
),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user