Skip to content
This repository has been archived by the owner on Sep 23, 2022. It is now read-only.

Commit

Permalink
Added basic test suite skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Jousse committed Feb 22, 2011
1 parent 3a206fb commit 05650f0
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/client-server-mapper.js
Expand Up @@ -53,6 +53,13 @@ ClientServerMapper.prototype.init = function() {
ClientServerMapper.prototype.map = function(client, server) {
var self = this;

if(client.uuid == null) {
throw new Error("Your client should have an uuid");
}

if(server.uuid == null) {
throw new Error("Your server should have an uuid");
}

return this;

Expand Down Expand Up @@ -85,3 +92,6 @@ ClientServerMapper.prototype.getServerForClient = function(client) {
return this;

}


module.exports = ClientServerMapper;
37 changes: 37 additions & 0 deletions test/client-server-mapper_test.js
@@ -0,0 +1,37 @@
var fs = require( 'fs' )
, path = require( 'path' )

require.paths.unshift( path.join( __dirname, '..', 'lib' ) )

var ClientServerMapper = require( 'client-server-mapper' );


/* ------------------------------ Fixtures ------------------------------ */

var client = {
, name: 'some client name'
, description: 'some client description'
};


var server = {
, name: 'some server name'
, description: 'some server description'
};

exports['uuid exception'] = function(test) {
var mapper = new ClientServerMapper();

test.throws(
function() {
mapper.map(client, server);
},
'/uuid/'
);

test.finish();
};

/* ------------------------------ Run ------------------------------ */
if ( module == require.main )
require( 'async_testing' ).run( __filename, process.ARGV )

0 comments on commit 05650f0

Please sign in to comment.