Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
alvagi
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
alvagi
Commits
1e9c0c52
Commit
1e9c0c52
authored
Jan 17, 2015
by
sergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add some commands
parent
0b607a38
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
context.js
lib/context.js
+12
-0
index.js
test/index.js
+21
-0
No files found.
lib/context.js
View file @
1e9c0c52
...
...
@@ -105,10 +105,18 @@ Context.prototype.getVariable = function (name, cb) {
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
)
{
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
)
{
this
.
send
(
'
ANSWER
'
+
'
\n
'
,
cb
||
function
()
{
});
};
...
...
@@ -161,4 +169,8 @@ Context.prototype.end = function() {
this
.
stream
.
end
();
};
Context
.
prototype
.
asyncAGIBreak
=
function
(
cb
)
{
this
.
send
(
'
ASYNCAGI BREAK
\n
'
,
cb
||
function
()
{
});
};
module
.
exports
=
Context
;
\ No newline at end of file
test/index.js
View file @
1e9c0c52
...
...
@@ -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
()
{
it
(
'
sends correct command
'
,
function
()
{
this
.
context
.
getVariable
(
'
test
'
);
...
...
@@ -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
()
{
it
(
'
sends "ANSWER
\\
n"
'
,
function
()
{
this
.
context
.
answer
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment