more tests for partial update
This commit is contained in:
parent
10a04da42c
commit
e9aa46a8f7
|
@ -104,21 +104,36 @@ var RealmTests = {
|
|||
});
|
||||
|
||||
realm.write(function() {
|
||||
var obj0 = realm.create('StringPrimaryObject', ['0', 'val0']);
|
||||
var obj0 = realm.create('StringPrimaryObject', ['0', true, 1, 1.1, 1.11, '1', new Date(1), '1']);
|
||||
|
||||
TestCase.assertThrows(function() {
|
||||
realm.create('StringPrimaryObject', ['0', 'val0']);
|
||||
realm.create('StringPrimaryObject', ['0', true, 1, 1.1, 1.11, '1', new Date(1), '1']);
|
||||
});
|
||||
realm.create('StringPrimaryObject', ['1', 'val1'], true);
|
||||
realm.create('StringPrimaryObject', ['1', true, 2, 2.2, 2.11, '2', new Date(2), '2'], true);
|
||||
var objects = realm.objects('StringPrimaryObject');
|
||||
TestCase.assertEqual(objects.length, 2);
|
||||
|
||||
realm.create('StringPrimaryObject', ['0', 'newVal0'], true);
|
||||
TestCase.assertEqual(obj0.valueCol, 'newVal0');
|
||||
realm.create('StringPrimaryObject', ['0', false, 2, 2.2, 2.22, '2', new Date(2), '2'], true);
|
||||
TestCase.assertEqual(objects.length, 2);
|
||||
TestCase.assertEqual(obj0.stringCol, '2');
|
||||
TestCase.assertEqual(obj0.boolCol, false);
|
||||
TestCase.assertEqual(obj0.intCol, 2);
|
||||
TestCase.assertEqualWithTolerance(obj0.floatCol, 2.2, 0.000001);
|
||||
TestCase.assertEqual(obj0.doubleCol, 2.22);
|
||||
TestCase.assertEqual(obj0.dateCol.getTime(), 2);
|
||||
TestCase.assertEqual(obj0.dataCol, '2');
|
||||
|
||||
realm.create('StringPrimaryObject', {primaryCol: '0'}, true);
|
||||
TestCase.assertEqual(obj0.valueCol, 'newVal0');
|
||||
realm.create('StringPrimaryObject', { primaryCol: '0' }, true);
|
||||
TestCase.assertEqual(obj0.stringCol, '2');
|
||||
|
||||
realm.create('StringPrimaryObject', { primaryCol: '0', stringCol: '3' }, true);
|
||||
TestCase.assertEqual(obj0.stringCol, '3');
|
||||
TestCase.assertEqual(obj0.boolCol, false);
|
||||
TestCase.assertEqual(obj0.intCol, 2);
|
||||
TestCase.assertEqualWithTolerance(obj0.floatCol, 2.2, 0.000001);
|
||||
TestCase.assertEqual(obj0.doubleCol, 2.22);
|
||||
TestCase.assertEqual(obj0.dateCol.getTime(), 2);
|
||||
TestCase.assertEqual(obj0.dataCol, '2');
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -73,6 +73,12 @@ var StringPrimaryObjectSchema = {
|
|||
primaryKey: 'primaryCol',
|
||||
properties: [
|
||||
{name: 'primaryCol', type: RealmType.String},
|
||||
{name: 'valueCol', type: RealmType.String},
|
||||
{name: 'boolCol', type: RealmType.Bool},
|
||||
{name: 'intCol', type: RealmType.Int},
|
||||
{name: 'floatCol', type: RealmType.Float},
|
||||
{name: 'doubleCol', type: RealmType.Double},
|
||||
{name: 'stringCol', type: RealmType.String},
|
||||
{name: 'dateCol', type: RealmType.Date},
|
||||
{name: 'dataCol', type: RealmType.Data},
|
||||
]
|
||||
};
|
Loading…
Reference in New Issue