From 0fdb0084778515c6af101feb9ea280f76c687145 Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Thu, 28 Apr 2016 14:08:54 -0700 Subject: [PATCH] test fixes/additions --- tests/js/migration-tests.js | 4 ++++ tests/js/realm-tests.js | 23 +++++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/tests/js/migration-tests.js b/tests/js/migration-tests.js index eabadf25..366ac7f0 100644 --- a/tests/js/migration-tests.js +++ b/tests/js/migration-tests.js @@ -106,6 +106,10 @@ module.exports = BaseTest.extend({ TestCase.assertEqual(newObjects[0].prop1, 1); newObjects[0].renamed = oldObjects[0].prop0; + + TestCase.assertThrows(function() { + oldObjects[0].prop0 = 'throws'; + }); } }); diff --git a/tests/js/realm-tests.js b/tests/js/realm-tests.js index b378456a..b83462e3 100644 --- a/tests/js/realm-tests.js +++ b/tests/js/realm-tests.js @@ -350,27 +350,30 @@ module.exports = BaseTest.extend({ new Realm({schema: [NotIndexed], path: '1'}); + var IndexedSchema = { + name: 'IndexedSchema', + }; TestCase.assertThrows(function() { - schemas.IndexedTypes.properties = { floatCol: {type: 'float', indexed: true} } - new Realm({schema: [schemas.IndexedTypes], path: '2'}); + IndexedSchema.properties = { floatCol: {type: 'float', indexed: true} }; + new Realm({schema: [IndexedSchema], path: '2'}); }); TestCase.assertThrows(function() { - schemas.IndexedTypes.properties = { doubleCol: {type: 'double', indexed: true} } - new Realm({schema: [schemas.IndexedTypes], path: '3'}); + IndexedSchema.properties = { doubleCol: {type: 'double', indexed: true} } + new Realm({schema: [IndexedSchema], path: '3'}); }); TestCase.assertThrows(function() { - schemas.IndexedTypes.properties = { dataCol: {type: 'data', indexed: true} } - new Realm({schema: [schemas.IndexedTypes], path: '4'}); + IndexedSchema.properties = { dataCol: {type: 'data', indexed: true} } + new Realm({schema: [IndexedSchema], path: '4'}); }); // primary key - schemas.IndexedTypes.primaryKey = 'boolCol'; - schemas.IndexedTypes.properties = { boolCol: {type: 'bool', indexed: true} } + IndexedSchema.properties = { boolCol: {type: 'bool', indexed: true} }; + IndexedSchema.primaryKey = 'boolCol'; - // Test this doesn't throw - new Realm({schema: [schemas.IndexedTypes], path: '5'}); + // Test this doesn't throw + new Realm({schema: [IndexedSchema], path: '5'}); }, testRealmCreateWithDefaults: function() {