Permalink
Browse files

fix tests for the removal of .parse() and .parseArgs()

  • Loading branch information...
1 parent 1179316 commit 583acb80a67cf9a4990934c8b85e7d8003e74c4b @substack committed Jun 19, 2012
Showing with 3 additions and 73 deletions.
  1. +1 −1 index.js
  2. +0 −57 test/args.js
  3. +1 −7 test/fn.js
  4. +1 −8 test/proto.js
View
@@ -110,7 +110,7 @@ var Session = exports.Session = function (id, wrapper) {
}
}
else if (typeof req.method == 'number') {
- var fn = self.locatlStore.get(req.method);
+ var fn = self.localStore.get(req.method);
if (!fn) {
self.emit('fail', new Error('no such method'));
}
View
@@ -1,57 +0,0 @@
-var test;
-try { test = require('tap').test; }
-catch (e) { test = require('testling') }
-
-var protocol = require('../');
-
-function argv () { return arguments }
-
-test('args', function (t) {
- t.deepEqual(
- protocol.parseArgs(argv('moo.com', 555)),
- { host : 'moo.com', port : 555 }
- );
-
- t.deepEqual(
- protocol.parseArgs(argv('7777')),
- { port : 7777 }
- );
-
- t.deepEqual(
- protocol.parseArgs(argv({
- host : 'moosy.moo.com',
- port : 5050
- })),
- { host : 'moosy.moo.com', port : 5050 }
- );
-
- t.deepEqual(
- protocol.parseArgs(argv('meow.cats.com', { port : '1234' })),
- { host : 'meow.cats.com', port : 1234 }
- );
-
- t.deepEqual(
- typeof protocol.parseArgs(argv('789')).port,
- 'number'
- );
-
- t.deepEqual(
- protocol.parseArgs(argv(
- { host : 'woof.dogs.com' }, { port : 4050 }
- )),
- { host : 'woof.dogs.com', port : 4050 }
- );
-
- t.deepEqual(
- protocol.parseArgs(argv(
- undefined,
- { host : 'woof.dogs.com' },
- undefined,
- { port : 4050 },
- undefined
- )),
- { host : 'woof.dogs.com', port : 4050 }
- );
-
- t.end();
-});
View
@@ -7,7 +7,7 @@ var traverse = require('traverse');
var EventEmitter = require('events').EventEmitter;
test('protoFn', function (t) {
- t.plan(10);
+ t.plan(8);
var server = proto(function (remote, conn) {
t.ok(conn);
@@ -77,10 +77,4 @@ test('protoFn', function (t) {
callbacks : { 0 : [ '0' ], 1 : [ '1' ] },
links : []
} ]);
-
- c.on('error', function (err) {
- t.ok(/JSON/.test(String(err)));
- t.ok(err instanceof SyntaxError);
- });
- c.parse('{');
});
View
@@ -3,7 +3,7 @@ var proto = require('../');
var traverse = require('traverse');
test('proto hashes', function (t) {
- t.plan(7);
+ t.plan(4);
var server = proto({
x : function (f, g) {
@@ -66,11 +66,4 @@ test('proto hashes', function (t) {
callbacks : { 0 : [ '0' ], 1 : [ '1' ] },
links : [],
} ]);
-
- c.on('error', function (err) {
- t.ok(err.stack);
- t.ok(err.message.match(/^Error parsing JSON/));
- t.ok(err instanceof SyntaxError);
- });
- c.parse('{');
});

0 comments on commit 583acb8

Please sign in to comment.