47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
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');
|
|
});
|
|
});
|