Skip to content

Commit

Permalink
added test and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cadorn committed Sep 7, 2012
1 parent 435c61f commit d668a1a
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 6 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
connect-architect-*.tgz
package/
/node_modules/
node_modules/
5 changes: 3 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
connect-architect-*.tgz
/package/
node_modules/
/demo/
/tests/
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
connect-architect
=================

[Connect](https://github.com/senchalabs/connect) for [architect](https://github.com/c9/connect-architect).


Demo
====

npm install
cd ./demo
node server
open http://localhost:8080

Test
====

npm install
npm test
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,22 @@
},
{
"name": "Christoph Dorn",
"email": "christoph@c9.io"
"email": "christoph@christophdorn.com"
}
],
"pm": "npm",
"dependencies": {
"architect": "~0.1.4",
"connect": "~2.4.5",
"netutil": "~0.0.1",
"mime": ">= 0.0.1"
},
"devDependencies": {
"request": "2.11.1"
},
"scripts": {
"test": "node test/all.js"
},
"repository": {
"type": "git",
"url": "http://github.com/c9/connect-architect.git"
Expand Down
35 changes: 35 additions & 0 deletions test/all.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

const ASSERT = require("assert");
const DEMO_SERVER = require("../demo/server");
const REQUEST = require("request");


function main(callback) {

DEMO_SERVER.main("default", function(err, app) {
if (err) return callback(err);

REQUEST("http://localhost:8080", function (error, response, body) {
if (error || response.statusCode !== 200) {
ASSERT.fail("Did not get status 200!");
return;
}

ASSERT.equal(body, "HelloWorld");

callback(null);
});
});
}


if (require.main === module) {
main(function(err) {
if (err) {
console.error(err.stack);
process.exit(1);
}
console.log("OK");
process.exit(0);
});
}

0 comments on commit d668a1a

Please sign in to comment.