I am looking for a good way to test custom finders defined on my collections. I use Velocity with the Jasmine testing framework, but my questions lends itself to any framework really.
I want to test the following collection:
...
Videos = new Mongo.Collection('videos');
Videos.attachSchema(VideosSchema);
/* Constants
*/
_.extend(Videos, {
SYNC_INTERVAL: 60000
});
/* Static methods
*/
_.extend(Videos, {
findVideosFromChannels: function(channelIds) {
return Videos.find({ channelId: { $in: channelIds } });
}
});
I want to write something like
describe('Videos', function() {
describe('#findVideosFromChannels', function() {
it('should only retrieve videos of specified channels', function() {
});
});
});
But I how can test a database query? It doesn't make sense to stub out the find call, since this is what i'm testing.
Any suggestions?
Aucun commentaire:
Enregistrer un commentaire