|
|
|
@ -160,7 +160,8 @@ describe('lib/utils', function() {
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('The dj class', function () {
|
|
|
|
|
describe('lib/music', function() {
|
|
|
|
|
|
|
|
|
|
const music = rewire('../lib/music');
|
|
|
|
|
const Readable = require('stream').Readable;
|
|
|
|
|
|
|
|
|
@ -176,6 +177,8 @@ describe('The dj class', function () {
|
|
|
|
|
return s;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('#DJ', function () {
|
|
|
|
|
|
|
|
|
|
it('connects to a VoiceChannel', function (done) {
|
|
|
|
|
let dj = new music.DJ(mockobjects.mockVoicechannel);
|
|
|
|
|
dj.connect().then(()=> {
|
|
|
|
@ -212,7 +215,7 @@ describe('The dj class', function () {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
assert(dj.playing);
|
|
|
|
|
done();
|
|
|
|
|
}, 211);
|
|
|
|
|
}, 100);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('gets the video name', function (done) {
|
|
|
|
@ -301,4 +304,46 @@ describe('The dj class', function () {
|
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('lib/cmd', function() {
|
|
|
|
|
const cmd = rewire('../lib/cmd');
|
|
|
|
|
cmd.__set__("logger", mockobjects.mockLogger);
|
|
|
|
|
|
|
|
|
|
describe('#Servant', function() {
|
|
|
|
|
|
|
|
|
|
it('creates commands', function() {
|
|
|
|
|
let servant = new cmd.Servant('');
|
|
|
|
|
servant.createCommand(mockobjects.mockCommand, mockobjects.mockCommand.textReply);
|
|
|
|
|
assert(servant.commands['test']);
|
|
|
|
|
servant.createCommand(mockobjects.mockCommand, mockobjects.mockCommand.promiseReply);
|
|
|
|
|
assert(servant.commands['test']);
|
|
|
|
|
servant.createCommand(mockobjects.mockCommand, mockobjects.mockCommand.richEmbedReply);
|
|
|
|
|
assert(servant.commands['test']);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('removes commands', function() {
|
|
|
|
|
let servant = new cmd.Servant('');
|
|
|
|
|
servant.createCommand(mockobjects.mockCommand, mockobjects.mockCommand.textReply);
|
|
|
|
|
assert(servant.commands['test']);
|
|
|
|
|
servant.removeCommand('test');
|
|
|
|
|
assert(!servant.commands['test'])
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('parses commands', function() {
|
|
|
|
|
let spy = sinon.spy();
|
|
|
|
|
let servant = new cmd.Servant('');
|
|
|
|
|
servant.createCommand(mockobjects.mockCommand, spy);
|
|
|
|
|
assert(servant.commands['test']);
|
|
|
|
|
assert(!spy.called);
|
|
|
|
|
servant.parseCommand({
|
|
|
|
|
content: 'test',
|
|
|
|
|
author: {
|
|
|
|
|
tag: undefined
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
assert(spy.called);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|