Skip to content

Commit

Permalink
[fix] Fix whitespace errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pksunkara committed Jul 11, 2012
1 parent d6afb75 commit 72fe125
Show file tree
Hide file tree
Showing 16 changed files with 65 additions and 65 deletions.
10 changes: 5 additions & 5 deletions lib/director/http/index.js
Expand Up @@ -57,7 +57,7 @@ Router.prototype.on = function (method, path) {
route.stream = true;
}

director.Router.prototype.on.call(this, method, path, route);
director.Router.prototype.on.call(this, method, path, route);
};

//
Expand Down Expand Up @@ -114,7 +114,7 @@ Router.prototype.dispatch = function (req, res, callback) {

runlist = this.runlist(fns);
stream = runlist.some(function (fn) { return fn.stream === true });

function parseAndInvoke() {
error = self.parse(req);
if (error) {
Expand All @@ -129,20 +129,20 @@ Router.prototype.dispatch = function (req, res, callback) {

if (!stream) {
//
// If there is no streaming required on any of the functions on the
// If there is no streaming required on any of the functions on the
// way to `path`, then attempt to parse the fully buffered request stream
// once it has emitted the `end` event.
//
if (req.readable) {
//
// If the `http.ServerRequest` is still readable, then await
// the end event and then continue
// the end event and then continue
//
req.once('end', parseAndInvoke)
}
else {
//
// Otherwise, just parse the body now.
// Otherwise, just parse the body now.
//
parseAndInvoke();
}
Expand Down
4 changes: 2 additions & 2 deletions test/browser/adhoc-test.js
Expand Up @@ -18,13 +18,13 @@ module("SS.js", {

asyncTest("adhoc routing", function() {

//
//

router.path('/a', function() {

// the bennifit of calling `this.route` as opposed to `this.get` or `this.post` is that
// you can continue to define the route structure (ad-hoc) and then assign units of logic
// per event type, there will be less repetition of definition, and the code will be more
// per event type, there will be less repetition of definition, and the code will be more
// readable/centralized.

this.path('/b', {
Expand Down
6 changes: 3 additions & 3 deletions test/browser/routes-test.js
Expand Up @@ -175,7 +175,7 @@ createTest('overlapping routes with tokens.', {
});
});

// // //
// // //
// // // Recursion features
// // // ----------------------------------------------------------

Expand Down Expand Up @@ -350,7 +350,7 @@ createTest('Breaking out of nested routes with forward recursion', {
// ABOVE IS WORKING
//

// //
// //
// // Special Events
// // ----------------------------------------------------------

Expand Down Expand Up @@ -478,7 +478,7 @@ createTest('resource object.', {
},
on: 'f2'
},
'/d': {
'/d': {
on: ['f1', 'f2']
}
},
Expand Down
12 changes: 6 additions & 6 deletions test/server/cli/dispatch-test.js
@@ -1,34 +1,34 @@
/*
* dispatch-test.js: Tests for the core dispatch method.
* dispatch-test.js: Tests for the core dispatch method.
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
*
*/

var assert = require('assert'),
vows = require('vows'),
director = require('../../../lib/director');

vows.describe('director/cli/dispatch').addBatch({
"An instance of director.cli.Router": {
topic: function () {
var router = new director.cli.Router(),
that = this;

that.matched = {};
that.matched['users'] = [];
that.matched['apps'] = []

router.on('users create', function () {
that.matched['users'].push('on users create');
});

router.on(/apps (\w+\s\w+)/, function () {
assert.equal(arguments.length, 1);
that.matched['apps'].push('on apps (\\w+\\s\\w+)');
});

return router;
},
"should have the correct routing table": function (router) {
Expand Down
14 changes: 7 additions & 7 deletions test/server/cli/path-test.js
@@ -1,32 +1,32 @@
/*
* dispatch-test.js: Tests for the core dispatch method.
* dispatch-test.js: Tests for the core dispatch method.
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
*
*/

var assert = require('assert'),
vows = require('vows'),
director = require('../../../lib/director');

vows.describe('director/cli/path').addBatch({
"An instance of director.cli.Router": {
topic: new director.cli.Router(),
"the path() method": {
"should create the correct nested routing table": function (router) {
function noop () {}

router.path(/apps/, function () {
router.path(/foo/, function () {
router.on(/bar/, noop);
});

router.on(/list/, noop);
});

router.on(/users/, noop);

assert.isObject(router.routes.apps);
assert.isFunction(router.routes.apps.list.on);
assert.isObject(router.routes.apps.foo);
Expand Down
10 changes: 5 additions & 5 deletions test/server/core/dispatch-test.js
@@ -1,15 +1,15 @@
/*
* dispatch-test.js: Tests for the core dispatch method.
* dispatch-test.js: Tests for the core dispatch method.
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
*
*/

var assert = require('assert'),
vows = require('vows'),
director = require('../../../lib/director');

vows.describe('director/core/dispatch').addBatch({
"An instance of director.Router": {
topic: function () {
Expand All @@ -18,7 +18,7 @@ vows.describe('director/core/dispatch').addBatch({
that.matched['/'] = [];
that.matched['foo'] = [];
that.matched['f*'] = []

var router = new director.Router({
'/': {
before: function () { that.matched['/'].push('before /') },
Expand Down Expand Up @@ -108,6 +108,6 @@ vows.describe('director/core/dispatch').addBatch({
assert.equal(this.matched.foo[4], 'on foo');
},
}
}
}
}
}).export(module);
14 changes: 7 additions & 7 deletions test/server/core/insert-test.js
@@ -1,5 +1,5 @@
/*
* insert-test.js: Tests for inserting routes into a normalized routing table.
* insert-test.js: Tests for inserting routes into a normalized routing table.
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
Expand All @@ -9,36 +9,36 @@
var assert = require('assert'),
vows = require('vows'),
director = require('../../../lib/director');

vows.describe('director/core/insert').addBatch({
"An instance of director.Router": {
topic: new director.Router(),
"the insert() method": {
"'on', ['foo', 'bar']": function (router) {
function route () { }

router.insert('on', ['foo', 'bar'], route);
assert.strictEqual(router.routes.foo.bar.on, route);
},
"'on', ['foo', 'bar'] again": function (router) {
function route () { }

router.insert('on', ['foo', 'bar'], route);
assert.isArray(router.routes.foo.bar.on);
assert.strictEqual(router.routes.foo.bar.on.length, 2);
},
"'on', ['foo', 'bar'] a third time": function (router) {
function route () { }

router.insert('on', ['foo', 'bar'], route);
assert.isArray(router.routes.foo.bar.on);
assert.strictEqual(router.routes.foo.bar.on.length, 3);
},
"'get', ['fizz', 'buzz']": function (router) {
function route () { }

router.insert('get', ['fizz', 'buzz'], route);
assert.strictEqual(router.routes.fizz.buzz.get, route);
assert.strictEqual(router.routes.fizz.buzz.get, route);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions test/server/core/on-test.js
Expand Up @@ -9,27 +9,27 @@
var assert = require('assert'),
vows = require('vows'),
director = require('../../../lib/director');

vows.describe('director/core/insert').addBatch({
"An instance of director.Router": {
topic: new director.Router(),
"the on() method": {
"['foo', 'bar']": function (router) {
function noop () { }

router.on(['foo', 'bar'], noop);
assert.strictEqual(router.routes.foo.on, noop);
assert.strictEqual(router.routes.bar.on, noop);
},
"'baz'": function (router) {
function noop () { }

router.on('baz', noop);
assert.strictEqual(router.routes.baz.on, noop);
},
"'after', 'baz'": function (router) {
function noop () { }

router.on('after', 'boo', noop);
assert.strictEqual(router.routes.boo.after, noop);
}
Expand Down
8 changes: 4 additions & 4 deletions test/server/core/path-test.js
@@ -1,23 +1,23 @@
/*
* path-test.js: Tests for the core `.path()` method.
* path-test.js: Tests for the core `.path()` method.
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
*
*/

var assert = require('assert'),
vows = require('vows'),
director = require('../../../lib/director');

vows.describe('director/core/path').addBatch({
"An instance of director.Router": {
topic: function () {
var that = this;
that.matched = {};
that.matched['foo'] = [];
that.matched['newyork'] = [];

var router = new director.Router({
'/foo': function () { that.matched['foo'].push('foo'); }
});
Expand Down
6 changes: 3 additions & 3 deletions test/server/helpers/index.js
@@ -1,5 +1,5 @@
/*
* index.js: Test helpers for director.
* index.js: Test helpers for director.
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
Expand Down Expand Up @@ -31,11 +31,11 @@ exports.handlers = {
streamBody: function () {
var body = '',
res = this.res;

this.req.on('data', function (chunk) {
body += chunk;
});

this.req.on('end', function () {
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(body);
Expand Down
10 changes: 5 additions & 5 deletions test/server/helpers/macros.js
@@ -1,11 +1,11 @@
/*
* macros.js: Test macros for director tests.
* macros.js: Test macros for director tests.
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
*
*/

var assert = require('assert'),
request = require('request');

Expand All @@ -15,20 +15,20 @@ exports.assertGet = function(port, uri, expected) {
request({ uri: 'http://localhost:' + port + '/' + uri }, this.callback);
}
};

context['should respond with `' + expected + '`'] = function (err, res, body) {
assert.isNull(err);
assert.equal(res.statusCode, 200);
assert.equal(body, expected);
};

return context;
};

exports.assertPost = function(port, uri, expected) {
return {
topic: function () {
request({
request({
method: 'POST',
uri: 'http://localhost:' + port + '/' + uri,
body: JSON.stringify(expected)
Expand Down
2 changes: 1 addition & 1 deletion test/server/http/attach-test.js
Expand Up @@ -5,7 +5,7 @@
* MIT LICENSE
*
*/

var assert = require('assert'),
http = require('http'),
vows = require('vows'),
Expand Down

0 comments on commit 72fe125

Please sign in to comment.