@@ -2,15 +2,7 @@ import React from 'react';
22
33import { Alert } from 'react-native' ;
44
5- import {
6- act ,
7- cleanup ,
8- fireEvent ,
9- render ,
10- screen ,
11- userEvent ,
12- waitFor ,
13- } from '@testing-library/react-native' ;
5+ import { act , cleanup , fireEvent , render , screen , waitFor } from '@testing-library/react-native' ;
146
157import * as AttachmentPickerUtils from '../../../contexts/attachmentPickerContext/AttachmentPickerContext' ;
168import { OverlayProvider } from '../../../contexts/overlayContext/OverlayProvider' ;
@@ -99,8 +91,6 @@ describe('MessageInput', () => {
9991 } ) ;
10092
10193 it ( 'should start the audio recorder on long press and cleanup on unmount' , async ( ) => {
102- const userBot = userEvent . setup ( ) ;
103-
10494 renderComponent ( {
10595 channelProps : { audioRecordingEnabled : true , channel } ,
10696 client,
@@ -109,8 +99,10 @@ describe('MessageInput', () => {
10999
110100 const { queryByTestId, unmount } = screen ;
111101
102+ const audioButton = queryByTestId ( 'audio-button' ) ;
103+
112104 act ( ( ) => {
113- userBot . longPress ( queryByTestId ( 'audio-button' ) , { duration : 1000 } ) ;
105+ fireEvent ( audioButton , 'longPress' ) ;
114106 } ) ;
115107
116108 await waitFor ( ( ) => {
@@ -132,8 +124,6 @@ describe('MessageInput', () => {
132124 } ) ;
133125
134126 it ( 'should trigger an alert if a normal press happened on audio recording' , async ( ) => {
135- const userBot = userEvent . setup ( ) ;
136-
137127 renderComponent ( {
138128 channelProps : { audioRecordingEnabled : true , channel } ,
139129 client,
@@ -142,8 +132,10 @@ describe('MessageInput', () => {
142132
143133 const { queryByTestId } = screen ;
144134
135+ const audioButton = queryByTestId ( 'audio-button' ) ;
136+
145137 act ( ( ) => {
146- userBot . press ( queryByTestId ( 'audio-button' ) ) ;
138+ fireEvent . press ( audioButton ) ;
147139 } ) ;
148140
149141 await waitFor ( ( ) => {
0 commit comments