<commit_before>
/**
 * Module dependencies.
 */

var assert = require('assert')
, connect = require('connect')
, DynamoDBStore = require('./')(connect);

var store = new DynamoDBStore({table : 'sessions-test', reapInterval : 2000});

// #set()
store.set('1234', {
	cookie: {
		maxAge: 2000
	}, 
	name: 'tj_reap'
}, function(err, ok){
	assert.ok(!err, '#set() got an error');
	assert.ok(ok, '#set() is not ok');
});

store.set('123', {
	cookie: {
		maxAge: 2000
	}, 
	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({
			cookie: {
				maxAge: 2000
			}, 
			name: 'tj'
		}, data);

		// #destroy
		store.destroy('123', function(err, data){
			assert.ok(!err, '#destroy() got an error');

			store.get('123', function(err, data){
				assert.strictEqual(data, null, '#get() should not find destroyed key');

				// #reap()
				setTimeout(function(){
					store.get('1234', function(err, data){
						assert.strictEqual(data, null, '#get() should not find destroyed key');
						
						console.log('done');
					});
				}, 4000);
			});
		});
	})
});<commit_msg>better test failure message<commit_after>
/**
 * Module dependencies.
 */

var assert = require('assert')
, connect = require('connect')
, DynamoDBStore = require('./')(connect);

var store = new DynamoDBStore({table : 'sessions-test', reapInterval : 2000});

// #set()
store.set('1234', {
	cookie: {
		maxAge: 2000
	}, 
	name: 'tj_reap'
}, function(err, ok){
	assert.ok(!err, '#set() got an error');
	assert.ok(ok, '#set() is not ok');
});

store.set('123', {
	cookie: {
		maxAge: 2000
	}, 
	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({
			cookie: {
				maxAge: 2000
			}, 
			name: 'tj'
		}, data);

		// #destroy
		store.destroy('123', function(err, data){
			assert.ok(!err, '#destroy() got an error');

			store.get('123', function(err, data){
				assert.strictEqual(data, null, '#get() should not find destroyed key');

				// #reap()
				setTimeout(function(){
					store.get('1234', function(err, data){
						assert.strictEqual(data, null, '#get() should not find reaped key');
						
						console.log('done');
					});
				}, 4000);
			});
		});
	})
});
{'fraction_non_alphanumeric': 0.21818181818181817, 'fraction_numerical': 0.03232323232323232, 'mean_word_length': 3.4532374100719423, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6654881', 'n_tokens_mistral': 1082, 'n_tokens_neox': 872, 'n_words': 213}