Skip to content

Commit

Permalink
chore: fix UT
Browse files Browse the repository at this point in the history
  • Loading branch information
guoxianzhe committed Oct 24, 2023
1 parent 17d7ec0 commit 6588176
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
14 changes: 2 additions & 12 deletions packages/rtc/test/impl/IAgoraMediaEngineImpl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,23 +107,13 @@ describe('IAgoraRtcEngineImpl', () => {
};
jest.spyOn(AgoraConsole, 'error');

let result = await callIrisWithoutCheck(
apiEnginePtr,
'MediaEngine_pushVideoFrame',
param2
);
expect(result.code).toBe(-NATIVE_RTC.ERROR_CODE_TYPE.ERR_FAILED);
await callIris(apiEnginePtr, 'MediaEngine_pushVideoFrame', param2);
expect(AgoraConsole.error).toBeCalledWith(
'call enableVideo(true) before startPreview'
);
jest.clearAllMocks();
await callIris(apiEnginePtr, 'RtcEngine_enableVideo', null);
let result2 = await callIrisWithoutCheck(
apiEnginePtr,
'MediaEngine_pushVideoFrame',
param2
);
expect(result2.code).toBe(-NATIVE_RTC.ERROR_CODE_TYPE.ERR_FAILED);
await callIris(apiEnginePtr, 'MediaEngine_pushVideoFrame', param2);
expect(AgoraConsole.error).toBeCalledWith(
'pushVideoFrameEnabled is disabled , call setExternalVideoSource first'
);
Expand Down
20 changes: 10 additions & 10 deletions packages/rtc/test/impl/IAgoraRtcEngineImpl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,19 +445,19 @@ describe('IAgoraRtcEngineImpl', () => {
};
await setupLocalVideo(apiEnginePtr, null);
jest.spyOn(irisRtcEngine.rtcEngineEventHandler, 'onLocalVideoStateChanged');
jest.spyOn(AgoraConsole, 'error');

let result = await callIrisWithoutCheck(
apiEnginePtr,
'RtcEngine_startPreview2',
param
await callIris(apiEnginePtr, 'RtcEngine_startPreview2', param);
expect(AgoraConsole.error).toBeCalledWith(
'call enableVideo(true) before startPreview'
);
expect(result.code).toBe(-NATIVE_RTC.ERROR_CODE_TYPE.ERR_FAILED);
let result2 = await callIrisWithoutCheck(
apiEnginePtr,
'RtcEngine_startPreview2',
{ sourceType: 100 }
jest.clearAllMocks();
await callIris(apiEnginePtr, 'RtcEngine_startPreview2', {
sourceType: 100,
});
expect(AgoraConsole.error).toBeCalledWith(
'call enableVideo(true) before startPreview'
);
expect(result2.code).toBe(-NATIVE_RTC.ERROR_CODE_TYPE.ERR_FAILED);
await callIris(apiEnginePtr, 'RtcEngine_enableVideo', null);
await callIris(apiEnginePtr, 'RtcEngine_startPreview2', param);
expect(
Expand Down

0 comments on commit 6588176

Please sign in to comment.