UNPKG

water-orm

Version:

A monolith version of Standalone waterline ORM

56 lines (42 loc) 1.23 kB
var Waterline = require('../../../lib/waterline'), assert = require('assert'); describe('Collection Query', function() { describe('.stream()', function() { var query; before(function(done) { var waterline = new Waterline(); var Model = Waterline.Collection.extend({ identity: 'user', connection: 'foo', attributes: { name: { type: 'string', defaultsTo: 'Foo Bar' }, doSomething: function() {} } }); waterline.loadCollection(Model); // Fixture Adapter Def var adapterDef = {}; var connections = { 'foo': { adapter: 'foobar' } }; waterline.initialize({ adapters: { foobar: adapterDef }, connections: connections }, function(err, colls) { if(err) return done(err); query = colls.collections.user; done(); }); }); it('should implement a streaming interface', function(done) { var stream = query.stream({}); // Just test for error now stream.on('error', function(err) { assert(err); done(); }); }); }); });