Permalink
Browse files

test indentation

  • Loading branch information...
1 parent 32f7dfb commit 60670d3b4da9834591301fbd227d98988e57a8b5 @tj tj committed Feb 26, 2011
Showing with 47 additions and 50 deletions.
  1. +2 −4 package.json
  2. +45 −46 test.js
View
@@ -1,11 +1,9 @@
{
"name": "connect-redis",
"description": "Redis session store for Connect",
- "version": "0.2.3",
+ "version": "1.0.0",
"author": "TJ Holowaychuk <tj@vision-media.ca>",
"main": "./index.js",
- "dependencies": {
- "redis": ">= 0.0.1"
- },
+ "dependencies": { "redis": ">= 0.0.1" },
"engines": { "node": ">= 0.1.98" }
}
View
@@ -3,59 +3,58 @@
* Module dependencies.
*/
-var assert = require('assert'),
- RedisStore = require('./index');
+var assert = require('assert')
+ , RedisStore = require('./');
-var store = new RedisStore({ maxAge: 150000 });
-var store_alt = new RedisStore({ maxAge: 150000, db: 15 });
+var store = new RedisStor;
+var store_alt = new RedisStore({ db: 15 });
store.client.on('connect', function(){
// #set()
store.set('123', { name: 'tj' }, function(err, ok){
- assert.ok(!err, '#set() got an error');
- assert.ok(ok, '#set() is not ok');
-
- // #get()
- store.get('123', function(err, data){
- assert.ok(!err, '#get() got an error');
- assert.deepEqual({ name: 'tj' }, data);
-
- // #length()
- store.length(function(err, len){
- assert.ok(!err, '#length() got an error');
- assert.equal(1, len, '#length() with keys');
-
- // #db option
- store_alt.length(function (err, len) {
- assert.ok(!err, '#alt db got an error');
- assert.equal(0, len, '#alt db with keys');
-
- // #clear()
- store.clear(function(err, ok){
- assert.ok(!err, '#clear()');
- assert.ok(ok, '#clear()');
-
- // #length()
- store.length(function(err, len){
- assert.ok(!err, '#length()');
- assert.equal(0, len, '#length() without keys');
-
- // #set null
- store.set('123', { name: 'tj' }, function(){
- store.destroy('123', function(){
- store.length(function(err, len){
- assert.equal(0, len, '#set() null');
- console.log('done');
- store.client.end();
- store_alt.client.end();
- });
- });
- });
- });
+ assert.ok(!err, '#set() got an error');
+ assert.ok(ok, '#set() is not ok');
+
+ // #get()
+ store.get('123', function(err, data){
+ assert.ok(!err, '#get() got an error');
+ assert.deepEqual({ name: 'tj' }, data);
+
+ // #length()
+ store.length(function(err, len){
+ assert.ok(!err, '#length() got an error');
+ assert.equal(1, len, '#length() with keys');
+
+ // #db option
+ store_alt.length(function (err, len) {
+ assert.ok(!err, '#alt db got an error');
+ assert.equal(0, len, '#alt db with keys');
+
+ // #clear()
+ store.clear(function(err, ok){
+ assert.ok(!err, '#clear()');
+ assert.ok(ok, '#clear()');
+
+ // #length()
+ store.length(function(err, len){
+ assert.ok(!err, '#length()');
+ assert.equal(0, len, '#length() without keys');
+
+ // #set null
+ store.set('123', { name: 'tj' }, function(){
+ store.destroy('123', function(){
+ store.length(function(err, len){
+ assert.equal(0, len, '#set() null');
+ console.log('done');
+ store.client.end();
+ store_alt.client.end();
});
+ });
});
+ });
});
- })
+ });
+ });
+ })
});
-
});

0 comments on commit 60670d3

Please sign in to comment.