Merge pull request #488 from realm/al-typos
fixes for typos and added upsert test
This commit is contained in:
commit
c7e156a7b8
|
@ -80,7 +80,7 @@ public:
|
|||
|
||||
struct ObserverState;
|
||||
|
||||
// Override this function if you want to recieve detailed information about
|
||||
// Override this function if you want to receive detailed information about
|
||||
// external changes to a specific set of objects.
|
||||
// This is called before each operation which may advance the read
|
||||
// transaction to include
|
||||
|
|
|
@ -322,7 +322,7 @@ namespace realm {
|
|||
|
||||
if (!try_update && row_index != realm::not_found) {
|
||||
throw DuplicatePrimaryKeyValueException(object_schema.name, *primary_prop,
|
||||
"Attempting to create an object of type '" + object_schema.name + "' with an exising primary key value.");
|
||||
"Attempting to create an object of type '" + object_schema.name + "' with an existing primary key value.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -273,7 +273,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
testRealmCreateUpsert: function() {
|
||||
var realm = new Realm({schema: [schemas.IntPrimary, schemas.AllTypes, schemas.TestObject]});
|
||||
var realm = new Realm({schema: [schemas.IntPrimary, schemas.StringPrimary, schemas.AllTypes, schemas.TestObject]});
|
||||
realm.write(function() {
|
||||
var values = {
|
||||
primaryCol: '0',
|
||||
|
@ -360,6 +360,19 @@ module.exports = {
|
|||
realm.create('AllTypesObject', {primaryCol: '1', objectCol: null}, true);
|
||||
TestCase.assertEqual(obj0.objectCol, null);
|
||||
TestCase.assertEqual(obj1.objectCol, null);
|
||||
|
||||
// test with string primaries
|
||||
var obj =realm.create('StringPrimaryObject', {
|
||||
primaryCol: '0',
|
||||
valueCol: 0
|
||||
});
|
||||
TestCase.assertEqual(obj.valueCol, 0);
|
||||
|
||||
realm.create('StringPrimaryObject', {
|
||||
primaryCol: '0',
|
||||
valueCol: 1
|
||||
}, true);
|
||||
TestCase.assertEqual(obj.valueCol, 1);
|
||||
});
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue