Skip to content
Browse files

Very first test.

  • Loading branch information...
1 parent 5cccce0 commit 904902c55f279f46f459215c00db542161d52c69 @colin-jack committed Oct 27, 2012
Showing with 105 additions and 19 deletions.
  1. +5 −15 .gitignore
  2. +2 −0 .npmignore
  3. +1 −4 README.md
  4. +1 −0 index.js
  5. +5 −0 lib/entryPoint.js
  6. +3 −0 lib/getJSON.js
  7. +5 −0 lib/namespace.js
  8. +60 −0 package.json
  9. +13 −0 spec/resourceWrapper.js
  10. +10 −0 spec/testFixture.js
View
20 .gitignore
@@ -1,15 +1,5 @@
-lib-cov
-*.seed
-*.log
-*.csv
-*.dat
-*.out
-*.pid
-*.gz
-
-pids
-logs
-results
-
-node_modules
-npm-debug.log
+*~
+/node_modules/*
+/*.sublime*
+/documents/*
+/documents/
View
2 .npmignore
@@ -0,0 +1,2 @@
+*~
+/node_modules/*
View
5 README.md
@@ -1,4 +1 @@
-testresources
-=============
-
-Adds some conventions to supertest to make testing HTTP APIs quicker.
+# test resources
View
1 index.js
@@ -0,0 +1 @@
+//module.exports =
View
5 lib/entryPoint.js
@@ -0,0 +1,5 @@
+module.exports = function(app) {
+ return {
+ getJSON : require('./getJSON')
+ }
+}
View
3 lib/getJSON.js
@@ -0,0 +1,3 @@
+module.exports = function(url) {
+
+}
View
5 lib/namespace.js
@@ -0,0 +1,5 @@
+// Brings all the files inside this directory into a namespace called 'lib', allowing you
+// to require using lib.require('{fileName}') without having to worry about the directory
+// structure involved.
+var requireNamespace = require('require-namespace');
+module.exports = requireNamespace.createSync('lib', __dirname + "/");
View
60 package.json
@@ -0,0 +1,60 @@
+{
+ "version": "0.0.1",
+
+ "name": "testresources",
+ "description": "Adds some conventions to supertest to make testing HTTP APIs quicker.",
+ "main": "index",
+
+ "preferGlobal": false,
+
+ "author": {
+ "name": "Colin Jack"
+ },
+
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/colin-jack/testresources.git"
+ },
+
+ "dependencies": {
+ "supertest": "*",
+ "objectcompare" : "*",
+ "async": "*",
+ "underscore": "*",
+ "require-namespace": "*",
+ "rules" : "*"
+ },
+
+ "keywords": [
+ "REST",
+ "RESTful",
+ "express",
+ "superagent",
+ "request",
+ "supertest",
+ "tdd",
+ "bdd",
+ "http",
+ "test",
+ "testing",
+ "resource oriented",
+ "ROA"
+ ],
+
+ "devDependencies": {
+ "longjohn": "*",
+ "chai": "*",
+ "mocha": "*"
+ },
+
+ "_npmUser": {
+ "name": "colin_jack",
+ "email": "colin.jack@gmail.com"
+ },
+
+ "license": "MIT",
+
+ "engines": {
+ "node": ">=0.6"
+ }
+}
View
13 spec/resourceWrapper.js
@@ -0,0 +1,13 @@
+var entryPoint = lib.require('entryPoint')
+
+describe('when you get the entry point', function() {
+ var underTest;
+
+ beforeEach(function() {
+ underTest = entryPoint({});
+ });
+
+ it('should have expected functions', function() {
+ assert.isFunction(underTest.getJSON);
+ });
+});
View
10 spec/testFixture.js
@@ -0,0 +1,10 @@
+// Might as well get long stack traces in tests.
+require('longjohn')
+
+// A namespace is used so that reorganising the folder containing the code under test doesn't result in
+// lots of broken tests (avoids paths like ./../../../lib/Resource from tests)
+var libNamespace = require('./../lib/namespace');
+global.lib = libNamespace;
+module.exports = libNamespace;
+
+global.assert = require('chai').assert;

0 comments on commit 904902c

Please sign in to comment.
Something went wrong with that request. Please try again.