Skip to content
This repository was archived by the owner on Feb 15, 2023. It is now read-only.

Commit c10c99b

Browse files
committed
Misc. cleanup
1 parent e80bd61 commit c10c99b

File tree

5 files changed

+29
-48
lines changed

5 files changed

+29
-48
lines changed

src/backends/base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ BaseBackend.prototype = {
2323
if (!filter(field, activity[field])) continue;
2424
var args = {
2525
activity: activity,
26-
field: field,
26+
field: field
2727
};
2828
fn(args);
2929
}

src/backends/waterline.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ util.inherits(Backend, baseBackend);
1414

1515
Backend.prototype.serializeValue = function(value) {
1616
throw new Error('Cant serialize for waterline since model.identity is not accessible from the instance');
17-
// if (typeof (value._id) != 'undefined') {
18-
// return value.constructor.modelName + ':' + value.id;
19-
// } else {
20-
// return value;
21-
// }
2217
};
2318

2419
(Backend.prototype.collectReferences = function(activities) {

test/backends/base_test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ describe('Base Backend', function() {
1414
{
1515
actor: 'User:123456',
1616
object: 'Tweet:00001',
17-
other: 'something',
18-
},
17+
other: 'something'
18+
}
1919
]);
2020

2121
expect(refs).to.eql({
2222
User: ['123456'],
23-
Tweet: ['00001'],
23+
Tweet: ['00001']
2424
});
2525
});
2626

@@ -29,8 +29,8 @@ describe('Base Backend', function() {
2929
{
3030
actor: 'User:123456',
3131
object: 'Tweet:00001',
32-
origin: 'Tweet:00002',
33-
},
32+
origin: 'Tweet:00002'
33+
}
3434
]);
3535

3636
expect(refs).to.eql({
@@ -44,8 +44,8 @@ describe('Base Backend', function() {
4444
{
4545
actor: 'User:123456',
4646
object: 'Tweet:00001',
47-
other: 'Tweet:00002',
48-
},
47+
other: 'Tweet:00002'
48+
}
4949
]);
5050

5151
expect(refs).to.eql({
@@ -61,7 +61,7 @@ describe('Base Backend', function() {
6161
var activity = {
6262
actor: 'User:123456',
6363
object: 'Tweet:1',
64-
other: 'matthisk',
64+
other: 'matthisk'
6565
};
6666

6767
backend.serializeActivity(activity);

test/backends/mongoose_test.js

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var tweetSchema = new Schema({
2525
text: String,
2626
actor: { type: Schema.Types.ObjectId, ref: 'User' },
2727
bg: String,
28-
link: { type: Schema.Types.ObjectId, ref: 'Link' },
28+
link: { type: Schema.Types.ObjectId, ref: 'Link' }
2929
});
3030

3131
tweetSchema.plugin(StreamMongoose.activity);
@@ -37,7 +37,7 @@ tweetSchema.statics.pathsToPopulate = function() {
3737
tweetSchema.methods.activityNotify = function() {
3838
return [
3939
stream.FeedManager.getFeed('notification', '1'),
40-
stream.FeedManager.getFeed('notification', '2'),
40+
stream.FeedManager.getFeed('notification', '2')
4141
];
4242
};
4343

@@ -136,7 +136,7 @@ describe('Backend', function() {
136136
backend.serializeActivities(activities2);
137137
var aggregatedActivities = [
138138
{ actor_count: 1, activities: activities },
139-
{ actor_count: 1, activities: activities2 },
139+
{ actor_count: 1, activities: activities2 }
140140
];
141141
backend
142142
.enrichAggregatedActivities(aggregatedActivities)
@@ -172,7 +172,7 @@ describe('Backend', function() {
172172
var activity = tweet.createActivity();
173173
backend.serializeActivities([activity]);
174174
var aggregatedActivities = [
175-
{ actor_count: 1, activities: [activity] },
175+
{ actor_count: 1, activities: [activity] }
176176
];
177177
backend
178178
.enrichAggregatedActivities(aggregatedActivities)
@@ -201,7 +201,7 @@ describe('Backend', function() {
201201
backend.serializeActivities([activity]);
202202
var aggregatedActivities = [
203203
{ actor_count: 1, activities: [activity] },
204-
{ actor_count: 1, activities: [activity, activity] },
204+
{ actor_count: 1, activities: [activity, activity] }
205205
];
206206
backend
207207
.enrichAggregatedActivities(aggregatedActivities)
@@ -258,14 +258,8 @@ describe('Backend', function() {
258258
.then(function(enriched) {
259259
enriched.should.length(1);
260260
enriched[0].should.have.property('actor');
261-
enriched[0]['actor'].should.have.property(
262-
'_id',
263-
self.actor._id,
264-
);
265-
enriched[0].should.have.property(
266-
'foreign_id',
267-
'Tweet:' + tweet._id,
268-
);
261+
enriched[0]['actor'].should.have.property('_id', self.actor._id);
262+
enriched[0].should.have.property('foreign_id', 'Tweet:' + tweet._id);
269263
});
270264
});
271265

@@ -290,10 +284,7 @@ describe('Backend', function() {
290284
.then(function(enriched) {
291285
enriched.should.length(1);
292286
enriched[0].should.have.property('actor');
293-
enriched[0]['actor'].should.have.property(
294-
'_id',
295-
self.actor._id,
296-
);
287+
enriched[0]['actor'].should.have.property('_id', self.actor._id);
297288
enriched[0].should.have.property('object');
298289
enriched[0]['object'].should.have.property('_id', tweet._id);
299290
enriched[0]['object'].should.have.property('text', tweet.text);
@@ -318,10 +309,7 @@ describe('Backend', function() {
318309
.then(function(tweet) {
319310
var activity = tweet.createActivity();
320311
tweet.getStreamBackend().serializeActivities([activity]);
321-
activity.should.have.property(
322-
'actor',
323-
'User:' + tweet.actor._id,
324-
);
312+
activity.should.have.property('actor', 'User:' + tweet.actor._id);
325313
activity.should.have.property('link', 'Link:' + tweet.link._id);
326314
activity.should.have.property('bg', 'bgvalue');
327315
activity.should.have.property('object', 'Tweet:' + tweet._id);
@@ -366,7 +354,7 @@ describe('Backend', function() {
366354
.then(function() {
367355
var activities = [
368356
tweet1.createActivity(),
369-
tweet2.createActivity(),
357+
tweet2.createActivity()
370358
];
371359

372360
return backend.enrichActivities(activities);
@@ -375,9 +363,7 @@ describe('Backend', function() {
375363
enriched.should.length(2);
376364
enriched[0].should.have.property('foreign_id');
377365
enriched[1].should.have.property('foreign_id');
378-
enriched[0]['foreign_id'].should.not.equal(
379-
enriched[1]['foreign_id'],
380-
);
366+
enriched[0]['foreign_id'].should.not.equal(enriched[1]['foreign_id']);
381367
});
382368
});
383369
});
@@ -401,7 +387,7 @@ describe('Tweet', function() {
401387
var activity = tweet.createActivity();
402388
activity.should.have.property('to', [
403389
'notification:1',
404-
'notification:2',
390+
'notification:2'
405391
]);
406392
});
407393

test/backends/waterline_test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ describe('Waterline Backend', function() {
2222
{
2323
actor: 'User:123456',
2424
object: 'Tweet:00001',
25-
other: 'something',
25+
other: 'something'
2626
},
2727
]);
2828

2929
expect(refs).to.eql({
3030
User: ['123456'],
31-
Tweet: ['00001'],
31+
Tweet: ['00001']
3232
});
3333
});
3434

@@ -37,13 +37,13 @@ describe('Waterline Backend', function() {
3737
{
3838
actor: 'User:123456',
3939
object: 'Tweet:00001',
40-
origin: 'Tweet:00002',
40+
origin: 'Tweet:00002'
4141
},
4242
]);
4343

4444
expect(refs).to.eql({
4545
User: ['123456'],
46-
Tweet: ['00001'],
46+
Tweet: ['00001']
4747
});
4848
});
4949

@@ -52,13 +52,13 @@ describe('Waterline Backend', function() {
5252
{
5353
actor: 'User:123456',
5454
object: 'Tweet:00001',
55-
other: 'Tweet:00002',
56-
},
55+
other: 'Tweet:00002'
56+
}
5757
]);
5858

5959
expect(refs).to.eql({
6060
User: ['123456'],
61-
Tweet: ['00001', '00002'],
61+
Tweet: ['00001', '00002']
6262
});
6363
});
6464
});
@@ -87,7 +87,7 @@ describe('Waterline Backend', function() {
8787
return {
8888
exec: function(cb) {
8989
cb(null, [{ id: 0 }, { id: 1 }, { id: 2 }]);
90-
},
90+
}
9191
};
9292
},
9393
};

0 commit comments

Comments
 (0)