From 60a58382b4441cecb2fd47ded8930bceff09d1a1 Mon Sep 17 00:00:00 2001 From: Scott Kyle Date: Tue, 24 May 2016 10:23:36 -0700 Subject: [PATCH] Add tests where deletion happens before snapshot() --- tests/js/results-tests.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/js/results-tests.js b/tests/js/results-tests.js index f6d97339..09149967 100644 --- a/tests/js/results-tests.js +++ b/tests/js/results-tests.js @@ -340,6 +340,15 @@ module.exports = BaseTest.extend({ TestCase.assertEqual(snapshot[0], null); }); + realm.write(function() { + var objects = createTestObjects(10); + realm.deleteAll(); + + var snapshot = objects.snapshot(); + TestCase.assertEqual(objects.length, 0); + TestCase.assertEqual(snapshot.length, 0); + }); + realm.write(function() { var objects = createTestObjects(10); var snapshot = objects.snapshot(); @@ -349,5 +358,14 @@ module.exports = BaseTest.extend({ TestCase.assertEqual(snapshot.length, 10); TestCase.assertEqual(snapshot[0], null); }); + + realm.write(function() { + var objects = createTestObjects(10); + realm.delete(objects); + + var snapshot = objects.snapshot(); + TestCase.assertEqual(objects.length, 0); + TestCase.assertEqual(snapshot.length, 0); + }); } });