Skip to content

Commit 63026f4

Browse files
committed
fix(voip): fix remaining ESLint errors in VoipNative and test files
- Remove async from InMemoryVoipNative.setSpeaker/attach (no await needed); return Promise.resolve() explicitly - Rename unused callUuid -> _callUuid in ProductionVoipNative.markAvailable - Move imports to top of resetVoipState.test.ts and useCallStore.test.ts before jest.mock calls - Use type-only import for InMemoryVoipNative in useCallStore.test.ts - Fix import order in deepLinking.js (voipNative after redux-saga/effects)
1 parent 0102d51 commit 63026f4

4 files changed

Lines changed: 16 additions & 14 deletions

File tree

app/lib/services/voip/VoipNative.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ export class InMemoryVoipNative implements VoipNativePort {
5454
markAvailable: (callUuid: string) => {
5555
this.recorded.push({ cmd: 'markAvailable', callUuid });
5656
},
57-
setSpeaker: async (on: boolean) => {
57+
setSpeaker: (on: boolean) => {
5858
this.recorded.push({ cmd: 'setSpeaker', on });
59+
return Promise.resolve();
5960
},
6061
startAudio: () => {
6162
this.recorded.push({ cmd: 'startAudio' });
@@ -69,18 +70,18 @@ export class InMemoryVoipNative implements VoipNativePort {
6970
this.recorded.splice(0);
7071
}
7172

72-
async attach(opts: { onEvent(e: VoipNativeEvent): void }): Promise<{ detach(): void; pushToken: string }> {
73+
attach(opts: { onEvent(e: VoipNativeEvent): void }): Promise<{ detach(): void; pushToken: string }> {
7374
this._onEvent = opts.onEvent;
7475
const seeds = this._coldStartQueue.splice(0);
7576
for (const event of seeds) {
7677
this._onEvent(event);
7778
}
78-
return {
79+
return Promise.resolve({
7980
detach: () => {
8081
this._onEvent = null;
8182
},
8283
pushToken: ''
83-
};
84+
});
8485
}
8586

8687
__emit(event: VoipNativeEvent): void {
@@ -119,7 +120,7 @@ class ProductionVoipNative implements VoipNativePort {
119120
markActive: (callUuid: string) => {
120121
RNCallKeep.setCurrentCallActive(callUuid);
121122
},
122-
markAvailable: (callUuid: string) => {
123+
markAvailable: (_callUuid: string) => {
123124
RNCallKeep.setCurrentCallActive('');
124125
RNCallKeep.setAvailable(true);
125126
},

app/lib/services/voip/resetVoipState.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import { resetVoipState } from './resetVoipState';
2+
import { useCallStore } from './useCallStore';
3+
14
jest.mock('react-native-callkeep', () => ({
25
__esModule: true,
36
default: {
@@ -25,9 +28,6 @@ jest.mock('../../native/NativeVoip', () => ({
2528
}
2629
}));
2730

28-
import { resetVoipState } from './resetVoipState';
29-
import { useCallStore } from './useCallStore';
30-
3131
jest.mock('../../methods/helpers', () => ({
3232
...jest.requireActual('../../methods/helpers'),
3333
isIOS: false

app/lib/services/voip/useCallStore.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
import type { IClientMediaCall } from '@rocket.chat/media-signaling';
2+
3+
import { useCallStore } from './useCallStore';
4+
import { voipNative, type InMemoryVoipNative } from './VoipNative';
5+
16
jest.mock('react-native-webrtc', () => ({ registerGlobals: jest.fn() }));
27
jest.mock('react-native-callkeep', () => ({
38
__esModule: true,
@@ -25,11 +30,6 @@ jest.mock('../../native/NativeVoip', () => ({
2530
}
2631
}));
2732

28-
import type { IClientMediaCall } from '@rocket.chat/media-signaling';
29-
30-
import { useCallStore } from './useCallStore';
31-
import { voipNative, InMemoryVoipNative } from './VoipNative';
32-
3333
jest.mock('../../navigation/appNavigation', () => ({
3434
__esModule: true,
3535
default: { navigate: jest.fn(), back: jest.fn() }

app/sagas/deepLinking.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { InteractionManager } from 'react-native';
2-
import { voipNative } from '../lib/services/voip/VoipNative';
32
import I18n from 'i18n-js';
43
import { all, call, delay, put, select, take, takeLatest } from 'redux-saga/effects';
54

5+
import { voipNative } from '../lib/services/voip/VoipNative';
6+
67
import { shareSetParams } from '../actions/share';
78
import * as types from '../actions/actionsTypes';
89
import { appInit, appStart, appReady } from '../actions/app';

0 commit comments

Comments
 (0)