提交 6f15061b authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

More test units.

上级 bf309e06
......@@ -14,7 +14,7 @@ tap.test('room.createPeer() with no options must succeed', { timeout: 1000 }, (t
.then((room) =>
{
room.createPeer('alice')
.then(() => t.end())
.then(() => t.end())
.catch((error) => t.fail(`should not fail: ${error}`));
})
.catch((error) => t.fail(`should not fail: ${error}`));
......@@ -30,8 +30,29 @@ tap.test('room.createPeer() without peerId must fail', { timeout: 1000 }, (t) =>
.then((room) =>
{
room.createPeer()
.then(() => t.fail('should not succeed'))
.then(() => t.fail('should not succeed'))
.catch(() => t.end());
})
.catch((error) => t.fail(`should not fail: ${error}`));
});
tap.test('room.createPeer() with same `peerId` must fail', { timeout: 1000 }, (t) =>
{
let server = mediasoup.Server();
t.tearDown(() => server.close());
server.createRoom()
.then((room) =>
{
room.createPeer('alice')
.then(() =>
{
room.createPeer('alice')
.then(() => t.fail('should not succeed'))
.catch(() => t.end());
})
.catch((error) => t.fail(`should not fail: ${error}`));
})
.catch((error) => t.fail(`should not fail: ${error}`));
});
......@@ -33,7 +33,7 @@ tap.test('server.updateSettings() with invalid options must fail', { timeout: 10
t.tearDown(() => server.close());
server.updateSettings({ logLevel: 'WRONG_LOG_LEVEL' })
.then(() => t.fail('should not succeed'))
.then(() => t.fail('should not succeed'))
.catch(() => t.end());
});
......@@ -44,7 +44,7 @@ tap.test('server.updateSettings() in a closed Server must fail', { timeout: 1000
server.on('close', () =>
{
server.updateSettings({ logLevel: 'error' })
.then(() => t.fail('should not succeed'))
.then(() => t.fail('should not succeed'))
.catch(() => t.end());
});
......@@ -58,7 +58,7 @@ tap.test('server.createRoom() with no options must succeed', { timeout: 1000 },
t.tearDown(() => server.close());
server.createRoom()
.then(() => t.end())
.then(() => t.end())
.catch((error) => t.fail(`should not fail: ${error}`));
});
......@@ -69,7 +69,7 @@ tap.test('server.createRoom() in a closed Server must fail', { timeout: 1000 },
server.on('close', () =>
{
server.createRoom()
.then(() => t.fail('should not succeed'))
.then(() => t.fail('should not succeed'))
.catch(() => t.end());
});
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论