Skip to content

Commit

Permalink
test: add test code
Browse files Browse the repository at this point in the history
  • Loading branch information
shenxiaojie.316 committed Feb 6, 2025
1 parent 7294ebf commit 2115b7b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@coze/realtime-api",
"comment": "add test code",
"type": "patch"
}
],
"packageName": "@coze/realtime-api",
"email": "[email protected]"
}
7 changes: 7 additions & 0 deletions packages/realtime-api/test/client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,4 +398,11 @@ describe('EngineClient', () => {
);
});
});

describe('getRtcEngine', () => {
it('should get rtc engine', () => {
const engine = client.getRtcEngine();
expect(engine).toBeDefined();
});
});
});
9 changes: 9 additions & 0 deletions packages/realtime-api/test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ describe('RealtimeClient', () => {
initAIAnsExtension: vi.fn(),
changeAIAnsExtension: vi.fn(),
sendMessage: vi.fn(),
getRtcEngine: vi.fn(),
dispatch: vi.fn(),
} as any;
(EngineClient as vi.Mock).mockImplementation(() => mockEngineClient);
Expand Down Expand Up @@ -332,4 +333,12 @@ describe('RealtimeClient', () => {
});
});
});

describe('getRtcEngine', () => {
it('should return rtc engine instance', async () => {
await client.connect();
client.getRtcEngine();
expect(mockEngineClient.getRtcEngine).toHaveBeenCalled();
});
});
});

0 comments on commit 2115b7b

Please sign in to comment.