diff --git a/packages/rtc/test/impl/IAgoraMediaEngineImpl.test.ts b/packages/rtc/test/impl/IAgoraMediaEngineImpl.test.ts index c33cae5..2c91540 100644 --- a/packages/rtc/test/impl/IAgoraMediaEngineImpl.test.ts +++ b/packages/rtc/test/impl/IAgoraMediaEngineImpl.test.ts @@ -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' ); diff --git a/packages/rtc/test/impl/IAgoraRtcEngineImpl.test.ts b/packages/rtc/test/impl/IAgoraRtcEngineImpl.test.ts index d5578ac..3c6f40a 100644 --- a/packages/rtc/test/impl/IAgoraRtcEngineImpl.test.ts +++ b/packages/rtc/test/impl/IAgoraRtcEngineImpl.test.ts @@ -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(