You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
janus-client/test/plugin-handle-spec.js

111 lines
2.6 KiB

'use strict';
var config = require('./config').config;
var JanusServerMock = require('../src/mock/janus-server').JanusServer;
var Client = require('../src/client').Client;
var assert = require('chai').assert;
var mockServerPort = config.janus.server.port;
var mockServerUrl = config.janus.server.url;
describe('PluginHandle', function(){
var janusServerMock;
before(function(done){
janusServerMock = new JanusServerMock({
port: mockServerPort
});
janusServerMock.init().then(()=>{
done();
}).catch(()=>{
done(err);
});
});
after(function(){
janusServerMock.close();
});
var handle;
beforeEach(function(done){
var client = new Client({
url: mockServerUrl
});
client.onConnected(()=>{
client.createSession().then((session)=>{
return session.createVideoRoomHandle();
}).then((videoRoomHandle)=>{
handle = videoRoomHandle;
done();
}).catch((err)=>{
done(err);
});
});
client.connect();
});
it('should detach', function(done) {
handle.detach().then(()=>{
done();
}).catch((err)=>{
done(err);
});
});
it('should hangup', function(done) {
handle.hangup().then(()=>{
done();
}).catch((err)=>{
done(err);
});
});
it('should trickle', function(done) {
handle.trickle().then(()=>{
done();
}).catch((err)=>{
done(err);
});
});
it('should complete trickle', function(done) {
handle.trickleCompleted().then(()=>{
done();
}).catch((err)=>{
done(err);
});
});
describe('VideoRoomHandle', function() {
it('should create a new room', function(done){
handle.create().then(()=>{
done();
}).catch((err)=>{
done(err);
});
});
it('should destroy a room', function(done) {
done();
});
it('should check whether a room exists or not', function(done) {
done();
});
it('should list all rooms', function(done) {
handle.list().then((list)=>{
assert.isArray(list);
done();
}).catch((err)=>{
done(err);
});
});
it('should list all participants', function(done) {
done();
});
});
});