-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
19 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// LICENSE : MIT | ||
"use strict"; | ||
export default function (text) { | ||
return function (req, res, next) { | ||
res.end(text + "\n"); | ||
return function (req, res) { | ||
res.end(text); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
// LICENSE : MIT | ||
"use strict"; | ||
var assert = require("power-assert"); | ||
import assert from "power-assert"; | ||
import connect from "connect" | ||
import hello from "../../src/connect/hello"; | ||
|
||
import http from "http"; | ||
import fetch from "node-fetch"; | ||
describe("hello", function () { | ||
before(function () { | ||
var connect = require('connect'); | ||
var http = require('http'); | ||
var responseText = "test"; | ||
var server; | ||
before(function (done) { | ||
var app = connect(); | ||
app.use(hello("test")); | ||
http.createServer(app).listen(3000, done); | ||
app.use(hello(responseText)); | ||
server = http.createServer(app).listen(3000, done); | ||
}); | ||
after(function (done) { | ||
after(function () { | ||
server.close(); | ||
}); | ||
it("should return response text", function () { | ||
return fetch("http://localhost:3000") | ||
.then(res => res.text()) | ||
.then(text => { | ||
assert.equal(text, | ||
}); | ||
}); | ||
it("should return test", function () | ||
); | ||
}); |