Skip to content

Commit 20fcd03

Browse files
committed
Switched to spaces for indentation
1 parent 34dd019 commit 20fcd03

File tree

8 files changed

+800
-800
lines changed

8 files changed

+800
-800
lines changed

test/cache.js

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -7,98 +7,98 @@ var Concoction = require('concoction');
77
var EventEmitter = require('events').EventEmitter;
88

99
function EventEmitterCache() {
10-
this.cache = {};
10+
this.cache = {};
1111
}
1212

1313
EventEmitterCache.prototype.__proto__ = EventEmitter.prototype;
1414
EventEmitterCache.prototype.valid = function(conditions) {
15-
return conditions && conditions._id;
15+
return conditions && conditions._id;
1616
};
1717
EventEmitterCache.prototype.store = function(conditions, document, callback) {
18-
this.emit('store');
19-
var id = JSON.stringify(document._id);
20-
this.cache[id] = document;
21-
callback();
18+
this.emit('store');
19+
var id = JSON.stringify(document._id);
20+
this.cache[id] = document;
21+
callback();
2222
};
2323
EventEmitterCache.prototype.fetch = function(document, callback) {
24-
var id = JSON.stringify(document._id);
25-
if(this.cache[id]) this.emit('fetched');
26-
callback(this.cache[id]);
24+
var id = JSON.stringify(document._id);
25+
if(this.cache[id]) this.emit('fetched');
26+
callback(this.cache[id]);
2727
};
2828
EventEmitterCache.prototype.drop = function(document, callback) {
29-
var id = JSON.stringify(document._id);
30-
if(this.cache[id]) {
31-
delete this.cache[id];
32-
this.emit('dropped');
33-
}
34-
callback();
29+
var id = JSON.stringify(document._id);
30+
if(this.cache[id]) {
31+
delete this.cache[id];
32+
this.emit('dropped');
33+
}
34+
callback();
3535
};
3636

3737
describe('orm', function () {
38-
"use strict";
38+
"use strict";
3939

40-
describe('Model', function () {
41-
var db = null;
40+
describe('Model', function () {
41+
var db = null;
4242

43-
before(function (done) {
44-
db = new Database(config);
45-
db.connect(done);
46-
});
43+
before(function (done) {
44+
db = new Database(config);
45+
db.connect(done);
46+
});
4747

48-
describe('cache', function() {
49-
var model = null;
48+
describe('cache', function() {
49+
var model = null;
5050

51-
before(function(done) {
52-
model = new Model(db, 'model', {
53-
name: /.+/
54-
}, {
55-
preprocessors: [new Concoction.Rename({ _id: 'name' })],
56-
cache: new EventEmitterCache()
57-
});
51+
before(function(done) {
52+
model = new Model(db, 'model', {
53+
name: /.+/
54+
}, {
55+
preprocessors: [new Concoction.Rename({ _id: 'name' })],
56+
cache: new EventEmitterCache()
57+
});
5858

59-
model.remove(function(err) {
60-
if(err) return done(err);
59+
model.remove(function(err) {
60+
if(err) return done(err);
6161

62-
model.create({
63-
name: 'Demo1'
64-
}, function(err, instance) {
65-
if(err) return done(err);
66-
return done();
67-
});
68-
});
69-
});
62+
model.create({
63+
name: 'Demo1'
64+
}, function(err, instance) {
65+
if(err) return done(err);
66+
return done();
67+
});
68+
});
69+
});
7070

71-
describe('findOne', function() {
72-
it('should store newly retrieved documents in the cache', function(done) {
73-
var pending = 2;
74-
function almostDone() {
75-
if(!(--pending)) return done();
76-
}
71+
describe('findOne', function() {
72+
it('should store newly retrieved documents in the cache', function(done) {
73+
var pending = 2;
74+
function almostDone() {
75+
if(!(--pending)) return done();
76+
}
7777

78-
model.cache.once('store', almostDone);
78+
model.cache.once('store', almostDone);
7979

80-
model.findOne('Demo1', function(err, instance) {
81-
should.not.exist(err);
82-
should.exist(instance);
83-
almostDone();
84-
});
85-
});
80+
model.findOne('Demo1', function(err, instance) {
81+
should.not.exist(err);
82+
should.exist(instance);
83+
almostDone();
84+
});
85+
});
8686

87-
it('should fetch retrieved documents from the cache', function(done) {
88-
var pending = 2;
89-
function almostDone() {
90-
if(!(--pending)) return done();
91-
}
87+
it('should fetch retrieved documents from the cache', function(done) {
88+
var pending = 2;
89+
function almostDone() {
90+
if(!(--pending)) return done();
91+
}
9292

93-
model.cache.once('fetched', almostDone);
93+
model.cache.once('fetched', almostDone);
9494

95-
model.findOne('Demo1', function(err, instance) {
96-
should.not.exist(err);
97-
should.exist(instance);
98-
almostDone();
99-
});
100-
});
101-
});
102-
});
103-
});
95+
model.findOne('Demo1', function(err, instance) {
96+
should.not.exist(err);
97+
should.exist(instance);
98+
almostDone();
99+
});
100+
});
101+
});
102+
});
103+
});
104104
});

0 commit comments

Comments
 (0)