【m】修改为服务器录屏
This commit is contained in:
46
test/recording-session-manager.test.ts
Normal file
46
test/recording-session-manager.test.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import {
|
||||
getRecordingSession,
|
||||
listRecordingSessions,
|
||||
resetRecordingSessions,
|
||||
startRecordingSession,
|
||||
stopRecordingSession
|
||||
} from '../src/recording/session-manager';
|
||||
|
||||
describe('recording session manager', () => {
|
||||
beforeEach(() => {
|
||||
resetRecordingSessions();
|
||||
});
|
||||
|
||||
test('starts and lists a recording session', () => {
|
||||
const session = startRecordingSession({
|
||||
connectionId: 'room-1',
|
||||
layout: 'speaker',
|
||||
format: 'mp4'
|
||||
});
|
||||
|
||||
expect(session).toEqual(expect.objectContaining({
|
||||
connectionId: 'room-1',
|
||||
status: 'recording',
|
||||
layout: 'speaker',
|
||||
format: 'mp4'
|
||||
}));
|
||||
expect(getRecordingSession(session.id)).toEqual(session);
|
||||
expect(listRecordingSessions('room-1')).toEqual([session]);
|
||||
});
|
||||
|
||||
test('stops an existing recording session', () => {
|
||||
const session = startRecordingSession({ connectionId: 'room-1' });
|
||||
const stopped = stopRecordingSession(session.id);
|
||||
|
||||
expect(stopped).toEqual(expect.objectContaining({
|
||||
id: session.id,
|
||||
connectionId: 'room-1',
|
||||
status: 'stopped'
|
||||
}));
|
||||
expect(stopped?.stoppedAt).toEqual(expect.any(String));
|
||||
});
|
||||
|
||||
test('rejects missing connection id', () => {
|
||||
expect(() => startRecordingSession({ connectionId: '' })).toThrow('connectionId is required');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user