Skip to content

Commit

Permalink
test tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonSharratt committed Jan 31, 2020
1 parent 6bcc60f commit c796a32
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion microservices/requestApi/routes/routes/requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ var buildDynamic = function(projectConfig, db, notify, util, router){

console.log("Saving");
db.Request.getAll({_id: requestId}, 1, 1, req.user, function(findErr, findRes){
console.log("Inside get all", findErr, findRes, requestId);
console.log("Inside get all", requestId, findErr, findRes);
if (findErr || !findRes || findRes.length <= 0){
res.status(400);
res.json({error: "No such request"});
Expand Down
9 changes: 7 additions & 2 deletions microservices/requestApi/test/v1/requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,18 @@ describe("Requests", function() {
});
});

var incorrectId = activeRequestId.substring(0, activeRequestId.length-1)+"1";
if (incorrectId === activeRequestId){
incorrectId = activeRequestId.substring(0, activeRequestId.length-1)+"2";
}

it('it should fail to save a request', function (done) {
chai.request(server)
.put('/v1/save/' + activeRequestId.substring(0, activeRequestId.length-1)+"1")
.put('/v1/save/' + incorrectId)
.set("Authorization", "Bearer " + jwt)
.send({})
.end(function (err, res) {
console.log("it should fail to save a request", res.body);
console.log("it should fail to save a request", incorrectId, res.body);
res.should.have.status(400);
res.body.should.be.a('object');
res.body.should.have.property('error');
Expand Down

0 comments on commit c796a32

Please sign in to comment.