Skip to content

Commit

Permalink
Fix json-request test
Browse files Browse the repository at this point in the history
  • Loading branch information
simov committed Nov 25, 2014
1 parent d12b4e6 commit 9634268
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions tests/server.js
Expand Up @@ -82,14 +82,13 @@ exports.createPostJSONValidator = function (value, reqContentType) {
var r = ''
req.on('data', function (chunk) {r += chunk})
req.on('end', function () {
var parsedValue = JSON.parse(r)
assert.deepEqual(parsedValue, value)
assert.equal(r, JSON.stringify(value))
if (reqContentType) {
assert.ok(req.headers['content-type'])
assert.ok(~req.headers['content-type'].indexOf(reqContentType))
}
resp.writeHead(200, {'content-type':'application/json'})
resp.write(JSON.stringify({ status: 'OK', value: parsedValue }))
resp.write(r)
resp.end()
})
}
Expand Down
3 changes: 1 addition & 2 deletions tests/test-json-request.js
Expand Up @@ -25,8 +25,7 @@ function testJSONValue(testId, value) {
}
request(opts, function (err, resp, body) {
t.equal(err, null)
t.equal(body.status, 'OK')
t.deepEqual(body.value, value)
t.deepEqual(body, value)
t.end()
})
})
Expand Down

0 comments on commit 9634268

Please sign in to comment.