diff options
Diffstat (limited to '__tests__/view')
-rw-r--r-- | __tests__/view/com/composer/Autocomplete.test.tsx | 43 | ||||
-rw-r--r-- | __tests__/view/com/composer/ComposePost.test.tsx | 118 | ||||
-rw-r--r-- | __tests__/view/com/composer/SelectedPhoto.test.tsx | 70 | ||||
-rw-r--r-- | __tests__/view/com/login/CreateAccount.test.tsx | 58 | ||||
-rw-r--r-- | __tests__/view/com/profile/ProfileHeader.test.tsx | 110 | ||||
-rw-r--r-- | __tests__/view/lib/useAnimatedValue.test.tsx | 17 | ||||
-rw-r--r-- | __tests__/view/lib/useOnMainScroll.test.tsx | 49 | ||||
-rw-r--r-- | __tests__/view/screens/Login.test.tsx | 37 | ||||
-rw-r--r-- | __tests__/view/screens/NotFound.test.tsx | 21 | ||||
-rw-r--r-- | __tests__/view/screens/Search.test.tsx | 30 | ||||
-rw-r--r-- | __tests__/view/shell/mobile/Menu.test.tsx | 57 | ||||
-rw-r--r-- | __tests__/view/shell/mobile/TabsSelector.test.tsx | 100 |
12 files changed, 0 insertions, 710 deletions
diff --git a/__tests__/view/com/composer/Autocomplete.test.tsx b/__tests__/view/com/composer/Autocomplete.test.tsx deleted file mode 100644 index 57539b75e..000000000 --- a/__tests__/view/com/composer/Autocomplete.test.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import React from 'react' -import {Autocomplete} from '../../../../src/view/com/composer/Autocomplete' -import {cleanup, fireEvent, render} from '../../../../jest/test-utils' - -describe('Autocomplete', () => { - const onSelectMock = jest.fn() - const mockedProps = { - active: true, - items: [ - { - handle: 'handle.test', - displayName: 'Test Display', - }, - { - handle: 'handle2.test', - displayName: 'Test Display 2', - }, - ], - onSelect: onSelectMock, - } - - afterAll(() => { - jest.clearAllMocks() - cleanup() - }) - - it('renders a button for each user', async () => { - const {findAllByTestId} = render(<Autocomplete {...mockedProps} />) - const autocompleteButton = await findAllByTestId('autocompleteButton') - expect(autocompleteButton.length).toBe(2) - }) - - it('triggers onSelect by pressing the button', async () => { - const {findAllByTestId} = render(<Autocomplete {...mockedProps} />) - const autocompleteButton = await findAllByTestId('autocompleteButton') - - fireEvent.press(autocompleteButton[0]) - expect(onSelectMock).toHaveBeenCalledWith('handle.test') - - fireEvent.press(autocompleteButton[1]) - expect(onSelectMock).toHaveBeenCalledWith('handle2.test') - }) -}) diff --git a/__tests__/view/com/composer/ComposePost.test.tsx b/__tests__/view/com/composer/ComposePost.test.tsx deleted file mode 100644 index 5c5a61812..000000000 --- a/__tests__/view/com/composer/ComposePost.test.tsx +++ /dev/null @@ -1,118 +0,0 @@ -import React from 'react' -import {ComposePost} from '../../../../src/view/com/composer/ComposePost' -import {cleanup, fireEvent, render, waitFor} from '../../../../jest/test-utils' -import * as apilib from '../../../../src/state/lib/api' -import { - mockedAutocompleteViewStore, - mockedRootStore, -} from '../../../../__mocks__/state-mock' -import Toast from 'react-native-root-toast' - -describe('ComposePost', () => { - const mockedProps = { - replyTo: { - uri: 'testUri', - cid: 'testCid', - text: 'testText', - author: { - handle: 'test.handle', - displayName: 'test name', - avatar: '', - }, - }, - onPost: jest.fn(), - onClose: jest.fn(), - } - - afterAll(() => { - jest.clearAllMocks() - cleanup() - }) - - it('renders post composer', async () => { - const {findByTestId} = render(<ComposePost {...mockedProps} />) - const composePostView = await findByTestId('composePostView') - expect(composePostView).toBeTruthy() - }) - - it('closes composer', async () => { - const {findByTestId} = render(<ComposePost {...mockedProps} />) - const composerCancelButton = await findByTestId('composerCancelButton') - fireEvent.press(composerCancelButton) - expect(mockedProps.onClose).toHaveBeenCalled() - }) - - it('changes text and publishes post', async () => { - const postSpy = jest.spyOn(apilib, 'post').mockResolvedValue({ - uri: '', - cid: '', - }) - const toastSpy = jest.spyOn(Toast, 'show') - - const wrapper = render(<ComposePost {...mockedProps} />) - - const composerTextInput = await wrapper.findByTestId('composerTextInput') - fireEvent.changeText(composerTextInput, 'testing publish') - - const composerPublishButton = await wrapper.findByTestId( - 'composerPublishButton', - ) - fireEvent.press(composerPublishButton) - - expect(postSpy).toHaveBeenCalledWith( - mockedRootStore, - 'testing publish', - 'testUri', - undefined, - [], - new Set<string>(), - expect.anything(), - ) - - // Waits for request to be resolved - await waitFor(() => { - expect(mockedProps.onPost).toHaveBeenCalled() - expect(mockedProps.onClose).toHaveBeenCalled() - expect(toastSpy).toHaveBeenCalledWith('Your reply has been published', { - animation: true, - duration: 3500, - hideOnPress: true, - position: 50, - shadow: true, - }) - }) - }) - - it('selects autocomplete item', async () => { - jest - .spyOn(React, 'useMemo') - .mockReturnValueOnce(mockedAutocompleteViewStore) - - const {findAllByTestId} = render(<ComposePost {...mockedProps} />) - const autocompleteButton = await findAllByTestId('autocompleteButton') - - fireEvent.press(autocompleteButton[0]) - expect(mockedAutocompleteViewStore.setActive).toHaveBeenCalledWith(false) - }) - - it('selects photos', async () => { - const {findByTestId, queryByTestId} = render( - <ComposePost {...mockedProps} />, - ) - let photoCarouselPickerView = queryByTestId('photoCarouselPickerView') - expect(photoCarouselPickerView).toBeFalsy() - - const composerSelectPhotosButton = await findByTestId( - 'composerSelectPhotosButton', - ) - fireEvent.press(composerSelectPhotosButton) - - photoCarouselPickerView = await findByTestId('photoCarouselPickerView') - expect(photoCarouselPickerView).toBeTruthy() - - fireEvent.press(composerSelectPhotosButton) - - photoCarouselPickerView = queryByTestId('photoCarouselPickerView') - expect(photoCarouselPickerView).toBeFalsy() - }) -}) diff --git a/__tests__/view/com/composer/SelectedPhoto.test.tsx b/__tests__/view/com/composer/SelectedPhoto.test.tsx deleted file mode 100644 index 26059ae30..000000000 --- a/__tests__/view/com/composer/SelectedPhoto.test.tsx +++ /dev/null @@ -1,70 +0,0 @@ -import React from 'react' -import {SelectedPhoto} from '../../../../src/view/com/composer/SelectedPhoto' -import {cleanup, fireEvent, render} from '../../../../jest/test-utils' - -describe('SelectedPhoto', () => { - const mockedProps = { - selectedPhotos: ['mock-uri', 'mock-uri-2'], - onSelectPhotos: jest.fn(), - } - - afterAll(() => { - jest.clearAllMocks() - cleanup() - }) - - it('has no photos to render', () => { - const {queryByTestId} = render( - <SelectedPhoto selectedPhotos={[]} onSelectPhotos={jest.fn()} />, - ) - const selectedPhotosView = queryByTestId('selectedPhotosView') - expect(selectedPhotosView).toBeNull() - - const selectedPhotoImage = queryByTestId('selectedPhotoImage') - expect(selectedPhotoImage).toBeNull() - }) - - it('has 1 photos to render', async () => { - const {findByTestId} = render( - <SelectedPhoto - selectedPhotos={['mock-uri']} - onSelectPhotos={jest.fn()} - />, - ) - const selectedPhotosView = await findByTestId('selectedPhotosView') - expect(selectedPhotosView).toBeTruthy() - - const selectedPhotoImage = await findByTestId('selectedPhotoImage') - expect(selectedPhotoImage).toBeTruthy() - // @ts-expect-error - expect(selectedPhotoImage).toHaveStyle({width: 250}) - }) - - it('has 2 photos to render', async () => { - const {findAllByTestId} = render(<SelectedPhoto {...mockedProps} />) - const selectedPhotoImage = await findAllByTestId('selectedPhotoImage') - expect(selectedPhotoImage[0]).toBeTruthy() - // @ts-expect-error - expect(selectedPhotoImage[0]).toHaveStyle({width: 175}) - }) - - it('has 3 photos to render', async () => { - const {findAllByTestId} = render( - <SelectedPhoto - selectedPhotos={['mock-uri', 'mock-uri-2', 'mock-uri-3']} - onSelectPhotos={jest.fn()} - />, - ) - const selectedPhotoImage = await findAllByTestId('selectedPhotoImage') - expect(selectedPhotoImage[0]).toBeTruthy() - // @ts-expect-error - expect(selectedPhotoImage[0]).toHaveStyle({width: 85}) - }) - - it('removes a photo', async () => { - const {findAllByTestId} = render(<SelectedPhoto {...mockedProps} />) - const removePhotoButton = await findAllByTestId('removePhotoButton') - fireEvent.press(removePhotoButton[0]) - expect(mockedProps.onSelectPhotos).toHaveBeenCalledWith(['mock-uri-2']) - }) -}) diff --git a/__tests__/view/com/login/CreateAccount.test.tsx b/__tests__/view/com/login/CreateAccount.test.tsx deleted file mode 100644 index 0c13db6a2..000000000 --- a/__tests__/view/com/login/CreateAccount.test.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import React from 'react' -import {Keyboard} from 'react-native' -import {CreateAccount} from '../../../../src/view/com/login/CreateAccount' -import {cleanup, fireEvent, render} from '../../../../jest/test-utils' -import { - mockedSessionStore, - mockedShellStore, -} from '../../../../__mocks__/state-mock' - -describe('CreateAccount', () => { - const mockedProps = { - onPressBack: jest.fn(), - } - afterAll(() => { - jest.clearAllMocks() - cleanup() - }) - - it('renders form and creates new account', async () => { - const {findByTestId} = render(<CreateAccount {...mockedProps} />) - - const registerEmailInput = await findByTestId('registerEmailInput') - expect(registerEmailInput).toBeTruthy() - fireEvent.changeText(registerEmailInput, 'test@email.com') - - const registerHandleInput = await findByTestId('registerHandleInput') - expect(registerHandleInput).toBeTruthy() - fireEvent.changeText(registerHandleInput, 'test.handle') - - const registerPasswordInput = await findByTestId('registerPasswordInput') - expect(registerPasswordInput).toBeTruthy() - fireEvent.changeText(registerPasswordInput, 'testpass') - - const registerIs13Input = await findByTestId('registerIs13Input') - expect(registerIs13Input).toBeTruthy() - fireEvent.press(registerIs13Input) - - const createAccountButton = await findByTestId('createAccountButton') - expect(createAccountButton).toBeTruthy() - fireEvent.press(createAccountButton) - - expect(mockedSessionStore.createAccount).toHaveBeenCalled() - }) - - it('renders and selects service', async () => { - const keyboardSpy = jest.spyOn(Keyboard, 'dismiss') - const {findByTestId} = render(<CreateAccount {...mockedProps} />) - - const registerSelectServiceButton = await findByTestId( - 'registerSelectServiceButton', - ) - expect(registerSelectServiceButton).toBeTruthy() - fireEvent.press(registerSelectServiceButton) - - expect(mockedShellStore.openModal).toHaveBeenCalled() - expect(keyboardSpy).toHaveBeenCalled() - }) -}) diff --git a/__tests__/view/com/profile/ProfileHeader.test.tsx b/__tests__/view/com/profile/ProfileHeader.test.tsx deleted file mode 100644 index 6ffe1a9a2..000000000 --- a/__tests__/view/com/profile/ProfileHeader.test.tsx +++ /dev/null @@ -1,110 +0,0 @@ -import React from 'react' -import {cleanup, fireEvent, render} from '../../../../jest/test-utils' -import {ProfileViewModel} from '../../../../src/state/models/profile-view' -import {ProfileHeader} from '../../../../src/view/com/profile/ProfileHeader' -import { - mockedNavigationStore, - mockedProfileStore, - mockedShellStore, -} from '../../../../__mocks__/state-mock' - -describe('ProfileHeader', () => { - const mockedProps = { - view: mockedProfileStore, - onRefreshAll: jest.fn(), - } - afterAll(() => { - jest.clearAllMocks() - cleanup() - }) - - it('renders ErrorMessage on error', async () => { - const {findByTestId} = render( - <ProfileHeader - {...{ - view: { - ...mockedProfileStore, - hasError: true, - } as ProfileViewModel, - onRefreshAll: jest.fn(), - }} - />, - ) - - const profileHeaderHasError = await findByTestId('profileHeaderHasError') - expect(profileHeaderHasError).toBeTruthy() - }) - - it('presses and opens edit profile', async () => { - const {findByTestId} = render(<ProfileHeader {...mockedProps} />) - - const profileHeaderEditProfileButton = await findByTestId( - 'profileHeaderEditProfileButton', - ) - expect(profileHeaderEditProfileButton).toBeTruthy() - fireEvent.press(profileHeaderEditProfileButton) - - expect(mockedShellStore.openModal).toHaveBeenCalled() - }) - - it('presses and opens followers page', async () => { - const {findByTestId} = render(<ProfileHeader {...mockedProps} />) - - const profileHeaderFollowersButton = await findByTestId( - 'profileHeaderFollowersButton', - ) - expect(profileHeaderFollowersButton).toBeTruthy() - fireEvent.press(profileHeaderFollowersButton) - - expect(mockedNavigationStore.navigate).toHaveBeenCalledWith( - '/profile/testhandle/followers', - ) - }) - - // TODO - this will only pass if the profile has an avatar image set - // it('presses and opens avatar modal', async () => { - // const {findByTestId} = render(<ProfileHeader {...mockedProps} />) - - // const profileHeaderAviButton = await findByTestId('profileHeaderAviButton') - // expect(profileHeaderAviButton).toBeTruthy() - // fireEvent.press(profileHeaderAviButton) - - // expect(mockedShellStore.openLightbox).toHaveBeenCalled() - // }) - - it('presses and opens follows page', async () => { - const {findByTestId} = render(<ProfileHeader {...mockedProps} />) - - const profileHeaderFollowsButton = await findByTestId( - 'profileHeaderFollowsButton', - ) - expect(profileHeaderFollowsButton).toBeTruthy() - fireEvent.press(profileHeaderFollowsButton) - - expect(mockedNavigationStore.navigate).toHaveBeenCalledWith( - '/profile/testhandle/follows', - ) - }) - - it('toggles following', async () => { - const {findByTestId} = render( - <ProfileHeader - {...{ - view: { - ...mockedProfileStore, - did: 'test did 2', - } as ProfileViewModel, - onRefreshAll: jest.fn(), - }} - />, - ) - - const profileHeaderToggleFollowButton = await findByTestId( - 'profileHeaderToggleFollowButton', - ) - expect(profileHeaderToggleFollowButton).toBeTruthy() - fireEvent.press(profileHeaderToggleFollowButton) - - expect(mockedProps.view.toggleFollowing).toHaveBeenCalled() - }) -}) diff --git a/__tests__/view/lib/useAnimatedValue.test.tsx b/__tests__/view/lib/useAnimatedValue.test.tsx deleted file mode 100644 index 762dcc8f2..000000000 --- a/__tests__/view/lib/useAnimatedValue.test.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import {renderHook} from '../../../jest/test-utils' -import {useAnimatedValue} from '../../../src/view/lib/hooks/useAnimatedValue' - -describe('useAnimatedValue', () => { - it('creates an Animated.Value with the initial value passed to the hook', () => { - const {result} = renderHook(() => useAnimatedValue(10)) - // @ts-expect-error - expect(result.current.__getValue()).toEqual(10) - }) - - it('returns the same Animated.Value instance on subsequent renders', () => { - const {result, rerender} = renderHook(() => useAnimatedValue(10)) - const firstValue = result.current - rerender({}) - expect(result.current).toBe(firstValue) - }) -}) diff --git a/__tests__/view/lib/useOnMainScroll.test.tsx b/__tests__/view/lib/useOnMainScroll.test.tsx deleted file mode 100644 index 6fae03787..000000000 --- a/__tests__/view/lib/useOnMainScroll.test.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import React from 'react' -import {fireEvent, render} from '../../../jest/test-utils' -import {Home} from '../../../src/view/screens/Home' -import {mockedRootStore, mockedShellStore} from '../../../__mocks__/state-mock' - -describe('useOnMainScroll', () => { - const mockedProps = { - navIdx: '0-0', - params: {}, - visible: true, - } - - it('toggles minimalShellMode to true', () => { - jest.useFakeTimers() - const {getByTestId} = render(<Home {...mockedProps} />) - - fireEvent.scroll(getByTestId('homeFeed'), { - nativeEvent: { - contentOffset: {y: 20}, - contentSize: {height: 100}, - layoutMeasurement: {height: 50}, - }, - }) - - expect(mockedRootStore.shell.setMinimalShellMode).toHaveBeenCalledWith(true) - }) - - it('toggles minimalShellMode to false', () => { - jest.useFakeTimers() - const {getByTestId} = render(<Home {...mockedProps} />, { - ...mockedRootStore, - shell: { - ...mockedShellStore, - minimalShellMode: true, - }, - }) - - fireEvent.scroll(getByTestId('homeFeed'), { - nativeEvent: { - contentOffset: {y: 0}, - contentSize: {height: 100}, - layoutMeasurement: {height: 50}, - }, - }) - expect(mockedRootStore.shell.setMinimalShellMode).toHaveBeenCalledWith( - false, - ) - }) -}) diff --git a/__tests__/view/screens/Login.test.tsx b/__tests__/view/screens/Login.test.tsx deleted file mode 100644 index e347534b4..000000000 --- a/__tests__/view/screens/Login.test.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import React from 'react' -import {Login} from '../../../src/view/screens/Login' -import {cleanup, fireEvent, render} from '../../../jest/test-utils' - -describe('Login', () => { - afterAll(() => { - jest.clearAllMocks() - cleanup() - }) - - it('renders initial screen', () => { - const {getByTestId} = render(<Login />) - const signUpScreen = getByTestId('signinOrCreateAccount') - - expect(signUpScreen).toBeTruthy() - }) - - it('renders Signin screen', () => { - const {getByTestId} = render(<Login />) - const signInButton = getByTestId('signInButton') - - fireEvent.press(signInButton) - - const signInScreen = getByTestId('signIn') - expect(signInScreen).toBeTruthy() - }) - - it('renders CreateAccount screen', () => { - const {getByTestId} = render(<Login />) - const createAccountButton = getByTestId('createAccountButton') - - fireEvent.press(createAccountButton) - - const createAccountScreen = getByTestId('createAccount') - expect(createAccountScreen).toBeTruthy() - }) -}) diff --git a/__tests__/view/screens/NotFound.test.tsx b/__tests__/view/screens/NotFound.test.tsx deleted file mode 100644 index fd3c84b07..000000000 --- a/__tests__/view/screens/NotFound.test.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react' -import {NotFound} from '../../../src/view/screens/NotFound' -import {cleanup, fireEvent, render} from '../../../jest/test-utils' -import {mockedNavigationStore} from '../../../__mocks__/state-mock' - -describe('NotFound', () => { - afterAll(() => { - jest.clearAllMocks() - cleanup() - }) - - it('navigates home', async () => { - const navigationSpy = jest.spyOn(mockedNavigationStore, 'navigate') - const {getByTestId} = render(<NotFound />) - const navigateHomeButton = getByTestId('navigateHomeButton') - - fireEvent.press(navigateHomeButton) - - expect(navigationSpy).toHaveBeenCalledWith('/') - }) -}) diff --git a/__tests__/view/screens/Search.test.tsx b/__tests__/view/screens/Search.test.tsx deleted file mode 100644 index c53e80b42..000000000 --- a/__tests__/view/screens/Search.test.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import React from 'react' -import {Search} from '../../../src/view/screens/Search' -import {cleanup, fireEvent, render} from '../../../jest/test-utils' - -describe('Search', () => { - jest.useFakeTimers() - const mockedProps = { - navIdx: '0-0', - params: { - name: 'test name', - }, - visible: true, - } - - afterAll(() => { - jest.clearAllMocks() - cleanup() - }) - - it('renders with query', async () => { - const {findByTestId} = render(<Search {...mockedProps} />) - const searchTextInput = await findByTestId('searchTextInput') - - expect(searchTextInput).toBeTruthy() - fireEvent.changeText(searchTextInput, 'test') - - const searchScrollView = await findByTestId('searchScrollView') - expect(searchScrollView).toBeTruthy() - }) -}) diff --git a/__tests__/view/shell/mobile/Menu.test.tsx b/__tests__/view/shell/mobile/Menu.test.tsx deleted file mode 100644 index 313259041..000000000 --- a/__tests__/view/shell/mobile/Menu.test.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import React from 'react' -import {Menu} from '../../../../src/view/shell/mobile/Menu' -import {cleanup, fireEvent, render} from '../../../../jest/test-utils' -import {mockedNavigationStore} from '../../../../__mocks__/state-mock' - -describe('Menu', () => { - const onCloseMock = jest.fn() - - const mockedProps = { - visible: true, - onClose: onCloseMock, - } - - afterAll(() => { - jest.clearAllMocks() - cleanup() - }) - - it('renders menu', () => { - const {getByTestId} = render(<Menu {...mockedProps} />) - - const menuView = getByTestId('menuView') - - expect(menuView).toBeTruthy() - }) - - it('presses profile card button', () => { - const {getByTestId} = render(<Menu {...mockedProps} />) - - const profileCardButton = getByTestId('profileCardButton') - fireEvent.press(profileCardButton) - - expect(onCloseMock).toHaveBeenCalled() - expect(mockedNavigationStore.switchTo).toHaveBeenCalledWith(0, true) - }) - - it('presses search button', () => { - const {getByTestId} = render(<Menu {...mockedProps} />) - - const searchBtn = getByTestId('searchBtn') - fireEvent.press(searchBtn) - - expect(onCloseMock).toHaveBeenCalled() - expect(mockedNavigationStore.switchTo).toHaveBeenCalledWith(0, true) - expect(mockedNavigationStore.navigate).toHaveBeenCalledWith('/search') - }) - - it("presses notifications menu item' button", () => { - const {getByTestId} = render(<Menu {...mockedProps} />) - - const menuItemButton = getByTestId('menuItemButton-Notifications') - fireEvent.press(menuItemButton) - - expect(onCloseMock).toHaveBeenCalled() - expect(mockedNavigationStore.switchTo).toHaveBeenCalledWith(1, true) - }) -}) diff --git a/__tests__/view/shell/mobile/TabsSelector.test.tsx b/__tests__/view/shell/mobile/TabsSelector.test.tsx deleted file mode 100644 index be6bc967a..000000000 --- a/__tests__/view/shell/mobile/TabsSelector.test.tsx +++ /dev/null @@ -1,100 +0,0 @@ -import React from 'react' -import {Animated} from 'react-native' -import {TabsSelector} from '../../../../src/view/shell/mobile/TabsSelector' -import {cleanup, fireEvent, render} from '../../../../jest/test-utils' -import {mockedNavigationStore} from '../../../../__mocks__/state-mock' - -describe('TabsSelector', () => { - const onCloseMock = jest.fn() - - const mockedProps = { - active: true, - tabMenuInterp: new Animated.Value(0), - onClose: onCloseMock, - } - - afterAll(() => { - jest.clearAllMocks() - cleanup() - }) - - it('renders tabs selector', () => { - const {getByTestId} = render(<TabsSelector {...mockedProps} />) - - const tabsSelectorView = getByTestId('tabsSelectorView') - - expect(tabsSelectorView).toBeTruthy() - }) - - it('renders nothing if inactive', () => { - const {getByTestId} = render( - <TabsSelector {...{...mockedProps, active: false}} />, - ) - - const emptyView = getByTestId('emptyView') - - expect(emptyView).toBeTruthy() - }) - - // TODO - this throws currently, but the tabs selector isnt being used atm so I just disabled -prf - // it('presses share button', () => { - // const shareSpy = jest.spyOn(Share, 'share') - // const {getByTestId} = render(<TabsSelector {...mockedProps} />) - - // const shareButton = getByTestId('shareButton') - // fireEvent.press(shareButton) - - // expect(onCloseMock).toHaveBeenCalled() - // expect(shareSpy).toHaveBeenCalledWith({url: 'https://bsky.app/'}) - // }) - - it('presses clone button', () => { - const {getByTestId} = render(<TabsSelector {...mockedProps} />) - - const cloneButton = getByTestId('cloneButton') - fireEvent.press(cloneButton) - - expect(onCloseMock).toHaveBeenCalled() - expect(mockedNavigationStore.newTab).toHaveBeenCalled() - }) - - it('presses new tab button', () => { - const {getByTestId} = render(<TabsSelector {...mockedProps} />) - - const newTabButton = getByTestId('newTabButton') - fireEvent.press(newTabButton) - - expect(onCloseMock).toHaveBeenCalled() - expect(mockedNavigationStore.newTab).toHaveBeenCalledWith('/') - }) - - it('presses change tab button', () => { - const {getAllByTestId} = render(<TabsSelector {...mockedProps} />) - - const changeTabButton = getAllByTestId('changeTabButton') - fireEvent.press(changeTabButton[0]) - - expect(onCloseMock).toHaveBeenCalled() - expect(mockedNavigationStore.newTab).toHaveBeenCalledWith('/') - }) - - it('presses close tab button', () => { - const {getAllByTestId} = render(<TabsSelector {...mockedProps} />) - - const closeTabButton = getAllByTestId('closeTabButton') - fireEvent.press(closeTabButton[0]) - - expect(onCloseMock).toHaveBeenCalled() - expect(mockedNavigationStore.setActiveTab).toHaveBeenCalledWith(0) - }) - - it('presses swipes to close the tab', () => { - const {getByTestId} = render(<TabsSelector {...mockedProps} />) - - const tabsSwipable = getByTestId('tabsSwipable') - fireEvent(tabsSwipable, 'swipeableRightOpen') - - expect(onCloseMock).toHaveBeenCalled() - expect(mockedNavigationStore.setActiveTab).toHaveBeenCalledWith(0) - }) -}) |