Commit 1e9c0c52 authored by sergey's avatar sergey

add some commands

parent 0b607a38
...@@ -105,10 +105,18 @@ Context.prototype.getVariable = function (name, cb) { ...@@ -105,10 +105,18 @@ Context.prototype.getVariable = function (name, cb) {
this.send('GET VARIABLE ' + name + '\n', cb || function() { }); this.send('GET VARIABLE ' + name + '\n', cb || function() { });
}; };
Context.prototype.getFullVariable = function (variable, channel, cb) {
this.send('GET FULL VARIABLE ' + variable + ' ' + channel + '\n', cb || function() { });
};
Context.prototype.setVariable = function (name, value, cb) { Context.prototype.setVariable = function (name, value, cb) {
this.send('SET VARIABLE ' + name + ' ' + value + '\n', cb || function() { }); this.send('SET VARIABLE ' + name + ' ' + value + '\n', cb || function() { });
}; };
Context.prototype.channelStatus = function (name, cb) {
this.send('CHANNEL STATUS ' + name + '\n', cb || function() { });
};
Context.prototype.answer = function (cb) { Context.prototype.answer = function (cb) {
this.send('ANSWER' + '\n', cb || function() { }); this.send('ANSWER' + '\n', cb || function() { });
}; };
...@@ -161,4 +169,8 @@ Context.prototype.end = function() { ...@@ -161,4 +169,8 @@ Context.prototype.end = function() {
this.stream.end(); this.stream.end();
}; };
Context.prototype.asyncAGIBreak = function (cb) {
this.send('ASYNCAGI BREAK\n', cb || function() { });
};
module.exports = Context; module.exports = Context;
\ No newline at end of file
...@@ -153,6 +153,20 @@ describe('Context', function() { ...@@ -153,6 +153,20 @@ describe('Context', function() {
}); });
}); });
describe('channelStatus', function() {
it('sends correct command', function() {
this.context.channelStatus('test');
expect(this.context.sent.join('')).to.eql('CHANNEL STATUS test\n');
});
});
describe('getFullVariable', function() {
it('sends correct command', function() {
this.context.getFullVariable('test', 'test');
expect(this.context.sent.join('')).to.eql('GET FULL VARIABLE test test\n');
});
});
describe('getVariable', function() { describe('getVariable', function() {
it('sends correct command', function() { it('sends correct command', function() {
this.context.getVariable('test'); this.context.getVariable('test');
...@@ -238,6 +252,13 @@ describe('Context', function() { ...@@ -238,6 +252,13 @@ describe('Context', function() {
}); });
}); });
describe('asyncAGIBreak', function() {
it('sends "ASYNCAGI BREAK\\n"', function() {
this.context.asyncAGIBreak();
expect(this.context.sent.join('')).to.eql('ASYNCAGI BREAK\n');
});
});
describe('answer', function() { describe('answer', function() {
it('sends "ANSWER\\n"', function() { it('sends "ANSWER\\n"', function() {
this.context.answer(); this.context.answer();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment