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
e0c76e3a
Commit
e0c76e3a
authored
Jul 14, 2015
by
Dmitriev Sergey
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7 from finnhaedicke/value-in-response
store the response value in the response object
parents
1f962496
ca84383f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
context.js
lib/context.js
+3
-0
index.js
test/index.js
+18
-0
No files found.
lib/context.js
View file @
e0c76e3a
...
...
@@ -86,6 +86,9 @@ Context.prototype.readResponseLine = function (line) {
code
:
parseInt
(
parsed
[
1
]),
result
:
parsed
[
2
].
trim
(),
};
if
(
parsed
[
3
])
{
response
.
value
=
parsed
[
3
];
}
//our last command had a pending callback
if
(
this
.
pending
)
{
...
...
test/index.js
View file @
e0c76e3a
...
...
@@ -103,6 +103,24 @@ describe('Context', function() {
});
});
it
(
'
includes the response value
'
,
function
(
done
)
{
var
context
=
this
.
context
;
process
.
nextTick
(
function
()
{
context
.
exec
(
'
test
'
,
'
bang
'
,
'
another
'
);
context
.
stream
.
write
(
'
200
'
);
context
.
stream
.
write
(
'
result=0 (a value)
\n\n
'
);
});
context
.
on
(
'
response
'
,
function
(
msg
)
{
expect
(
msg
.
code
).
to
.
equal
(
200
);
expect
(
msg
.
result
).
to
.
eql
(
'
0
'
);
expect
(
msg
.
value
).
to
.
eql
(
'
a value
'
);
done
();
});
});
});
describe
(
'
two commands
'
,
function
(
done
)
{
...
...
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