Skip to content

Commit

Permalink
Started tests with utils.base64
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Sep 15, 2010
1 parent d92fcb5 commit c41fcdc
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
@@ -0,0 +1,3 @@
[submodule "support/expresso"]
path = support/expresso
url = git://github.com/visionmedia/expresso.git
6 changes: 6 additions & 0 deletions Makefile
@@ -0,0 +1,6 @@

test:
@./support/expresso/bin/expresso test/*.test.js \
-I lib

.PHONY: test
7 changes: 0 additions & 7 deletions lib/ns3.js

This file was deleted.

13 changes: 13 additions & 0 deletions lib/ns3/auth.js
@@ -0,0 +1,13 @@

/*!
* ns3 - auth
* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/

/**
* Module dependencies.
*/

var http = require('http')
, fs = require('fs');
22 changes: 22 additions & 0 deletions lib/ns3/index.js
@@ -0,0 +1,22 @@

/*!
* ns3
* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/

/**
* Library version.
*
* @type String
*/

exports.version = '0.0.1';

/**
* Expose utilities.
*
* @type Object
*/

exports.utils = require('./utils');
22 changes: 22 additions & 0 deletions lib/ns3/utils.js
@@ -0,0 +1,22 @@

/*!
* ns3 - utils
* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/

/**
* Module dependencies.
*/

var crypto = require('crypto');

exports.base64 = {
encode: function(str){
return new Buffer(str).toString('base64');
},

decode: function(str){
return new Buffer(str, 'base64').toString();
}
};
1 change: 1 addition & 0 deletions support/expresso
Submodule expresso added at d05bb6
12 changes: 12 additions & 0 deletions test/ns3.test.js
@@ -0,0 +1,12 @@

/**
* Module dependencies.
*/

var ns3 = require('ns3');

module.exports = {
'test .version': function(assert){
assert.match(ns3.version, /^\d+\.\d+\.\d+$/);
}
};
17 changes: 17 additions & 0 deletions test/utils.test.js
@@ -0,0 +1,17 @@

/**
* Module dependencies.
*/

var ns3 = require('ns3')
, utils = ns3.utils;

module.exports = {
'test .base64.encode()': function(assert){
assert.equal('aGV5', utils.base64.encode('hey'));
},

'test .base64.decode()': function(assert){
assert.equal('hey', utils.base64.decode('aGV5'));
}
};

0 comments on commit c41fcdc

Please sign in to comment.