test and fix for date queries

This commit is contained in:
Ari Lazier 2015-11-10 16:11:57 -08:00
parent 3a198ec507
commit f3d7855c99
2 changed files with 10 additions and 9 deletions

View File

@ -203,14 +203,6 @@ struct ColumnGetter {
}
};
template <typename TableGetter>
struct ColumnGetter<DateTime, TableGetter> {
static Columns<Int> convert(TableGetter&& table, const PropertyExpression & expr, Arguments &args)
{
return table()->template column<Int>(expr.prop->table_column);
}
};
template <typename RequestedType, typename TableGetter>
struct ValueGetter;

View File

@ -235,7 +235,7 @@ module.exports = BaseTest.extend({
},
testRealmObjects: function() {
var realm = new Realm({schema: [schemas.PersonObject]});
var realm = new Realm({schema: [schemas.PersonObject, schemas.DefaultValues, schemas.TestObject]});
realm.write(function() {
realm.create('PersonObject', ['Ari', 10, false]);
realm.create('PersonObject', ['Tim', 11, false]);
@ -278,6 +278,15 @@ module.exports = BaseTest.extend({
TestCase.assertThrows(function() {
realm.objects('PersonObject', 'age > {2} && age < {0}', 13, 10)
});
realm.write(function() {
realm.create('DefaultValuesObject', {'dateCol': new Date(3)});
realm.create('DefaultValuesObject', {'dateCol': new Date(4)});
realm.create('DefaultValuesObject', {'dateCol': new Date(5)});
});
TestCase.assertEqual(realm.objects('DefaultValuesObject', 'dateCol > {0}', new Date(4)).length, 1);
TestCase.assertEqual(realm.objects('DefaultValuesObject', 'dateCol <= {0}', new Date(4)).length, 2);
},
testNotifications: function() {