From add592a32efbac5cccd787497876a63f77708a91 Mon Sep 17 00:00:00 2001 From: David Glasser Date: Wed, 28 Nov 2012 11:01:30 -0800 Subject: [PATCH] minimongo: Test observing a query-by-ID. Demonstrates that the optimization in PR #504 is not safe. --- packages/minimongo/minimongo_tests.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/minimongo/minimongo_tests.js b/packages/minimongo/minimongo_tests.js index be4502749e..57f947e219 100644 --- a/packages/minimongo/minimongo_tests.js +++ b/packages/minimongo/minimongo_tests.js @@ -168,6 +168,13 @@ _.each(['observe', '_observeUnordered'], function (observeMethod) { // After calling stop, no more callbacks are called. c.insert({_id: 5, name: "iris", tags: ["flower"]}); expect(""); + + // Test that observing a lookup by ID works. + handle = c.find(4)[observeMethod](makecb('b')); + expect('ab4_'); + c.update(4, {$set: {eek: 5}}); + expect('cb4_'); + handle.stop(); }); });