|
| 1 | +import { client, channelID, REQUEST_SUCCESS_CODE } from '../config'; |
| 2 | + |
| 3 | +describe('audio测试', () => { |
| 4 | + enum AudioPlayStatus { |
| 5 | + START = 0, // 开始播放 |
| 6 | + PAUSE = 1, // 暂停播放 |
| 7 | + RESUME = 2, // 继续播放 |
| 8 | + STOP = 3, // 停止播放 |
| 9 | + } |
| 10 | + test('【 postAudio方法 】=== 开始播放操作', async () => { |
| 11 | + const audioControl = { |
| 12 | + audioUrl: '', |
| 13 | + text: '', |
| 14 | + status: AudioPlayStatus.START, |
| 15 | + } |
| 16 | + const res = await client.audioApi.postAudio(channelID, audioControl); |
| 17 | + expect(res?.status).toStrictEqual(REQUEST_SUCCESS_CODE); |
| 18 | + }); |
| 19 | + |
| 20 | + test('【 postAudio方法 】=== 暂停播放操作', async () => { |
| 21 | + const audioControl = { |
| 22 | + audioUrl: '', |
| 23 | + text: '', |
| 24 | + status: AudioPlayStatus.PAUSE, |
| 25 | + } |
| 26 | + const res = await client.audioApi.postAudio(channelID, audioControl); |
| 27 | + expect(res?.status).toStrictEqual(REQUEST_SUCCESS_CODE); |
| 28 | + }); |
| 29 | + |
| 30 | + test('【 postAudio方法 】=== 继续播放操作', async () => { |
| 31 | + const audioControl = { |
| 32 | + audioUrl: '', |
| 33 | + text: '', |
| 34 | + status: AudioPlayStatus.RESUME, |
| 35 | + } |
| 36 | + const res = await client.audioApi.postAudio(channelID, audioControl); |
| 37 | + expect(res?.status).toStrictEqual(REQUEST_SUCCESS_CODE); |
| 38 | + }); |
| 39 | + |
| 40 | + test('【 postAudio方法 】=== 停止播放操作', async () => { |
| 41 | + const audioControl = { |
| 42 | + audioUrl: '', |
| 43 | + text: '', |
| 44 | + status: AudioPlayStatus.STOP, |
| 45 | + } |
| 46 | + const res = await client.audioApi.postAudio(channelID, audioControl); |
| 47 | + expect(res?.status).toStrictEqual(REQUEST_SUCCESS_CODE); |
| 48 | + }); |
| 49 | + |
| 50 | + test('【 botOnMic方法 】=== 机器人上麦', async () => { |
| 51 | + const res = await client.audioApi.botOnMic(channelID); |
| 52 | + expect(res?.status).toStrictEqual(REQUEST_SUCCESS_CODE); |
| 53 | + }); |
| 54 | + |
| 55 | + test('【 botOffMic方法 】=== 机器人下麦', async () => { |
| 56 | + const res = await client.audioApi.botOffMic(channelID); |
| 57 | + expect(res?.status).toStrictEqual(REQUEST_SUCCESS_CODE); |
| 58 | + }); |
| 59 | +}); |
0 commit comments