Add tests where deletion happens before snapshot()

This commit is contained in:
Scott Kyle 2016-05-24 10:23:36 -07:00
parent e14e922c39
commit 60a58382b4
1 changed files with 18 additions and 0 deletions

View File

@ -340,6 +340,15 @@ module.exports = BaseTest.extend({
TestCase.assertEqual(snapshot[0], null); 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() { realm.write(function() {
var objects = createTestObjects(10); var objects = createTestObjects(10);
var snapshot = objects.snapshot(); var snapshot = objects.snapshot();
@ -349,5 +358,14 @@ module.exports = BaseTest.extend({
TestCase.assertEqual(snapshot.length, 10); TestCase.assertEqual(snapshot.length, 10);
TestCase.assertEqual(snapshot[0], null); 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);
});
} }
}); });