Skip to content

Commit 69cd60c

Browse files
authored
fix(example): add LoopbackAudioTrack demo for ASS-3147 (#1490)
Migrate LoopbackAudioTrack demo from special/4.5.3 with menu entry and React test dependencies. Validated 77 tests, TypeScript, lint and formatting; tested tree 3ed356c.
1 parent 5895745 commit 69cd60c

9 files changed

Lines changed: 1005 additions & 0 deletions

File tree

‎babel.config.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ module.exports = {
22
presets: [
33
['@babel/preset-env', { targets: { node: 'current' } }],
44
'@babel/preset-typescript',
5+
'@babel/preset-react',
56
],
67
};
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import React from 'react';
2+
import { renderToStaticMarkup } from 'react-dom/server';
3+
4+
jest.mock('electron', () => ({ ipcRenderer: { invoke: jest.fn() } }));
5+
jest.mock('antd', () => ({
6+
...jest.requireActual('antd'),
7+
Table: ({ locale }: any) =>
8+
require('react').createElement('div', null, locale.emptyText),
9+
}));
10+
jest.mock('../../../config/agora.config', () => ({
11+
__esModule: true,
12+
default: {
13+
appId: 'test-app-id',
14+
channelId: 'test-channel',
15+
token: '',
16+
uid: 0,
17+
logFilePath: '',
18+
},
19+
}));
20+
jest.mock('../../../components/ui', () => ({
21+
AgoraButton: ({ title }: any) => <button>{title}</button>,
22+
AgoraDivider: () => <hr />,
23+
AgoraDropdown: ({ title }: any) => <div>{title}</div>,
24+
AgoraSlider: ({ title }: any) => <div>{title}</div>,
25+
AgoraStyle: { screen: 'screen', content: 'content', rightBar: 'right' },
26+
AgoraText: ({ children }: any) => <div>{children}</div>,
27+
AgoraTextInput: ({ value }: any) => <input value={value} readOnly />,
28+
AgoraView: ({ children, ...props }: any) => <div {...props}>{children}</div>,
29+
}));
30+
31+
import LoopbackAudioTrack from './LoopbackAudioTrack';
32+
33+
test('shows the track controls before joining a channel', () => {
34+
const markup = renderToStaticMarkup(<LoopbackAudioTrack />);
35+
36+
expect(markup).toContain('Loopback audio tracks');
37+
expect(markup).toContain('No loopback tracks');
38+
expect(markup).toContain('Capture source');
39+
expect(markup).toContain('Volume interval (ms)');
40+
expect(markup).toContain('Create loopback track');
41+
});

0 commit comments

Comments
 (0)