add test for current date

This commit is contained in:
Ari Lazier 2016-05-05 17:36:48 -07:00
parent 76c2d3cd54
commit 28a7efcd1b
2 changed files with 22 additions and 4 deletions

View File

@ -257,6 +257,10 @@
029048081C0428DF00ABDED4 /* js_realm.hpp */,
0290480A1C0428DF00ABDED4 /* js_results.hpp */,
0290480C1C0428DF00ABDED4 /* js_schema.hpp */,
F620F0521CAF0B600082977B /* js_class.hpp */,
F6874A3E1CACA5A900EEEE36 /* js_types.hpp */,
F6267BC91CADC30000AC36B1 /* js_util.hpp */,
F620F0591CB7B4C80082977B /* js_object_accessor.hpp */,
029048351C042A3C00ABDED4 /* platform.hpp */,
0290480F1C0428DF00ABDED4 /* rpc.cpp */,
029048101C0428DF00ABDED4 /* rpc.hpp */,
@ -321,10 +325,6 @@
F60103051CC4ADE500EC01BA /* JS */ = {
isa = PBXGroup;
children = (
F620F0521CAF0B600082977B /* js_class.hpp */,
F6874A3E1CACA5A900EEEE36 /* js_types.hpp */,
F6267BC91CADC30000AC36B1 /* js_util.hpp */,
F620F0591CB7B4C80082977B /* js_object_accessor.hpp */,
);
name = JS;
sourceTree = "<group>";

View File

@ -468,5 +468,23 @@ module.exports = BaseTest.extend({
TestCase.assertEqual(obj.ignored, undefined);
obj.ignored = true;
TestCase.assertEqual(obj.ignored, true);
},
testCurrentDate: function() {
var DateSchema = {
name: 'Date',
properties: {
currentDate: 'date'
}
};
var realm = new Realm({schema: [DateSchema]});
var currentDate = new Date();
var object;
realm.write(function() {
object = realm.create('Date', { currentDate: currentDate });
});
TestCase.assertEqual(currentDate.getTime(), object.currentDate.getTime());
}
});