Skip to content

Commit

Permalink
change agora-rtc-sdk-ng-fake dependency to github packages (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
guoxianzhe authored Oct 19, 2023
1 parent 48e6452 commit bbab630
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 96 deletions.
2 changes: 1 addition & 1 deletion packages/fake/rtc/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FakeAgoraRTCWrapper } from '@agoraio-extensions/agora-rtc-sdk-ng-fake';
import { ERROR_CODE_TYPE } from '@iris/native-rtc-binding';

import FakeAgoraRTCWrapper from 'agora-rtc-sdk-ng-fake';
import { AgoraConsole, IrisApiEngine, IrisRtcEngine } from 'iris-web-rtc';

import supportList = require('../../../scripts/terra/config/support_list.json');
Expand Down
2 changes: 1 addition & 1 deletion packages/fake/rtc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"@iris/native-rtc-binding": "workspace: *",
"agora-rtc-sdk-ng": "^4.18.2",
"agora-rtc-sdk-ng-fake": "https://github.com/AgoraIO-Extensions/agora-rtc-sdk-ng-fake/releases/download/v1.0.1/agora-rtc-sdk-ng-fake.tar.gz",
"@agoraio-extensions/agora-rtc-sdk-ng-fake": "latest",
"iris-web-rtc": "workspace: *"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/rtc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"dependencies": {
"@iris/native-rtc-binding": "workspace: *",
"agora-rtc-sdk-ng": "^4.18.2",
"@agoraio-extensions/agora-rtc-sdk-ng-fake": "latest",
"iris-web-core": "workspace: *"
},
"files": [
Expand Down
34 changes: 29 additions & 5 deletions packages/rtc/test/impl/IAgoraRtcEngineImpl.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { FakeAgoraRTCWrapper } from '@agoraio-extensions/agora-rtc-sdk-ng-fake';
import * as NATIVE_RTC from '@iris/native-rtc-binding';
import { AREAS, IAgoraRTC } from 'agora-rtc-sdk-ng';

import { IrisApiEngine, IrisCore } from 'iris-web-core';

import { IrisWebRtc } from '../../src/IrisRtcApi';

import { IrisAudioSourceType } from '../../src/base/BaseType';

import { IrisRtcEngine } from '../engine/IrisRtcEngine';
Expand All @@ -12,7 +15,9 @@ let irisRtcEngine: IrisRtcEngine;
let AgoraRTCMock: IAgoraRTC;
beforeAll(async () => {
apiEnginePtr = IrisCore.createIrisApiEngine();
IrisWebRtc.initIrisRtc(apiEnginePtr);
IrisWebRtc.initIrisRtc(apiEnginePtr, {
agoraRTC: FakeAgoraRTCWrapper.getFakeAgoraRTC(),
});
irisRtcEngine = apiEnginePtr['apiInterceptors'][0];
AgoraRTCMock = irisRtcEngine.globalState.AgoraRTC;
jest.spyOn(AgoraRTCMock, 'setArea');
Expand All @@ -21,7 +26,7 @@ beforeAll(async () => {
jest.spyOn(irisRtcEngine.implHelper, 'createAudioTrack');
jest.spyOn(irisRtcEngine, 'returnResult');

irisRtcEngine.implHelper.createAudioTrack = jest.fn();
// irisRtcEngine.implHelper.createAudioTrack = jest.fn();
let nParam = {
context: {
areaCode: 1,
Expand Down Expand Up @@ -84,8 +89,27 @@ describe('IAgoraRtcEngineImpl', () => {
);
expect(irisRtcEngine.returnResult).toBeCalledTimes(2);
});
test('joinChannel', () => {
console.log('joinChannel');
//call create engine
test('release', async () => {
jest.spyOn(irisRtcEngine.irisClientManager, 'release');
expect(
irisRtcEngine.irisClientManager.irisClientList.length === 1
).toBeTruthy();
let apiParam = new IrisCore.EventParam(
'RtcEngine_release',
JSON.stringify({ sync: false }),
0,
'',
['test'],
[],
1
);
await IrisCore.callIrisApi(apiEnginePtr, apiParam);
expect(irisRtcEngine.irisClientManager.release).toBeCalledTimes(1);
expect(
irisRtcEngine.irisClientManager.irisClientList.length === 0
).toBeTruthy();
expect(
irisRtcEngine.irisClientManager.irisClientList.length === 0
).toBeTruthy();
});
});
Loading

0 comments on commit bbab630

Please sign in to comment.