Skip to content

Commit

Permalink
travis
Browse files Browse the repository at this point in the history
  • Loading branch information
rook2pawn committed Jun 28, 2018
1 parent 89305ed commit ac4c2e2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
language: node_js
node_js:
- "7"
- "8"
- "9"
- "10"
20 changes: 19 additions & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,25 @@ test("get - express", (t) => {

});

test("post - router-middleware", (t) => {
t.plan(3);
const Router = require("router-middleware");
const app = Router();
app.post("/user/:userId/messages", Router.bodyParser, (req,res,next) => {
t.deepEquals(req.query, {language:"en"}, "Querystring is received");
t.equals(req.params.userId, "a1234", "path parameters is received");
return res.end(`doubled: ${req.body.num * 2}`)
})

const comm = request(app);
comm.post("/user/a1234/messages?language=en", {num:34})
.then((res) => {
t.equals(res.text, "doubled: 68", "postData received and text is property assigned to response");
comm.end();
})
});


test("post - express", (t) => {
t.plan(3);
const express = require("express");
Expand All @@ -53,5 +72,4 @@ test("post - express", (t) => {
t.equals(res.text, "doubled: 68", "postData received and text is property assigned to response");
comm.end();
})

});

0 comments on commit ac4c2e2

Please sign in to comment.