sharedb 3.2.2 → 3.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -187,18 +187,25 @@ module.exports = function(options) {
|
|
|
187
187
|
}
|
|
188
188
|
], function(err) {
|
|
189
189
|
if (err) return done(err);
|
|
190
|
+
|
|
191
|
+
var wait = 2;
|
|
192
|
+
function finish() {
|
|
193
|
+
if (--wait) return;
|
|
194
|
+
expect(util.pluck(query.results, 'id')).to.eql(['fido', 'spot', 'taco']);
|
|
195
|
+
done();
|
|
196
|
+
}
|
|
197
|
+
|
|
190
198
|
var query = connection.createSubscribeQuery('dogs', matchAllDbQuery, null, function(err) {
|
|
191
199
|
if (err) return done(err);
|
|
192
200
|
connection.close();
|
|
193
201
|
connection2.get('dogs', 'taco').on('error', done).create({age: 2});
|
|
194
202
|
process.nextTick(function() {
|
|
195
203
|
backend.connect(connection);
|
|
204
|
+
query.on('ready', finish);
|
|
196
205
|
});
|
|
197
206
|
});
|
|
198
207
|
query.on('error', done);
|
|
199
|
-
query.on('insert',
|
|
200
|
-
done();
|
|
201
|
-
});
|
|
208
|
+
query.on('insert', finish);
|
|
202
209
|
});
|
|
203
210
|
});
|
|
204
211
|
|
|
@@ -234,11 +241,14 @@ module.exports = function(options) {
|
|
|
234
241
|
], function(error) {
|
|
235
242
|
if (error) return done(error);
|
|
236
243
|
backend.connect(connection);
|
|
244
|
+
query.once('ready', function() {
|
|
245
|
+
finish();
|
|
246
|
+
});
|
|
237
247
|
});
|
|
238
248
|
});
|
|
239
249
|
});
|
|
240
250
|
|
|
241
|
-
var wait =
|
|
251
|
+
var wait = 3;
|
|
242
252
|
function finish() {
|
|
243
253
|
if (--wait) return;
|
|
244
254
|
var results = util.sortById(query.results);
|