Skip to content

Commit

Permalink
fix(connect): fix hello test
Browse files Browse the repository at this point in the history
  • Loading branch information
azu committed Sep 11, 2015
1 parent 4fbcc67 commit 8f6b720
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/connect/hello.js
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);
};
}
27 changes: 17 additions & 10 deletions test/connect/hello-test.js
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 ()
);
});

0 comments on commit 8f6b720

Please sign in to comment.