diff --git a/src/common/hooks/__tests__/useScrollContext.test.ts b/src/common/hooks/__tests__/useScrollContext.test.ts index ba7df1e..3fa740b 100644 --- a/src/common/hooks/__tests__/useScrollContext.test.ts +++ b/src/common/hooks/__tests__/useScrollContext.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest'; +import { renderHook as renderHookWithoutWrapper } from '@testing-library/react'; import { act, renderHook, waitFor } from 'test/test-utils'; @@ -16,6 +17,28 @@ describe('useScrollContext', () => { expect(result.current.scrollDirection).toBeUndefined(); }); + it('should return default context', async () => { + // ARRANGE + const { result } = renderHookWithoutWrapper(() => useScrollContext()); + await waitFor(() => expect(result.current).not.toBeNull()); + + // ACT + act(() => + result.current.handleIonScroll({ + // @ts-expect-error required detail attributes only + detail: { + startY: 0, + currentY: 100, + }, + }), + ); + + // ASSERT + expect(result.current).toBeDefined(); + expect(result.current.handleIonScroll).toBeDefined(); + expect(result.current.scrollDirection).toBeUndefined(); + }); + it('should set scroll direction down', async () => { // ARRANGE const { result } = renderHook(() => useScrollContext()); diff --git a/src/common/providers/__tests__/ProgressProvider.test.tsx b/src/common/providers/__tests__/ProgressProvider.test.tsx index 494301e..ee4fc99 100644 --- a/src/common/providers/__tests__/ProgressProvider.test.tsx +++ b/src/common/providers/__tests__/ProgressProvider.test.tsx @@ -1,9 +1,9 @@ import { describe, expect, it } from 'vitest'; +import userEvent from '@testing-library/user-event'; import { render, screen, waitFor } from 'test/test-utils'; import ProgressProvider from '../ProgressProvider'; -import userEvent from '@testing-library/user-event'; describe('ProgressProvider', () => { it('should render successfully', async () => {