-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testing new datatypes #2797
Testing new datatypes #2797
Conversation
…g object store. Add tests of embedded objects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 with some comments
@@ -1412,13 +1412,72 @@ module.exports = { | |||
|
|||
testCreateEmbeddedObjects: function() { | |||
const realm = new Realm({schema: [schemas.ContactSchema, schemas.AddressSchema]}); | |||
realm.write(() => { // FIXME: This should not be required! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this FIXME for now ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is fixed on the kneth/stitch-integration
branch (by fixing Realm.clearTestState()
).
for (let i = 0; i < numbers.length; i++) { | ||
let d128 = objects[i]['decimalCol']; | ||
TestCase.assertTrue(d128 instanceof Decimal128); | ||
TestCase.assertEqual(d128.toString(), numbers[i].toUpperCase()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will be really nice if we could add an equals(x: string): boolean
to all decimals128 values which does the comparison with the correct casing. I looked at https://github.com/mongodb/js-bson/blob/master/lib/decimal128.js and strangely enough there is no such thing
Do you think we can add such method in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
envisioning this as d128.equals(string)
|
||
for (let i = 0; i < values.length; i++) { | ||
let oid2 = objects[i]['id']; | ||
TestCase.assertTrue(oid2 instanceof ObjectId, 'instaceof'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is an TestCase.assertInstanceOf method
TestCase.assertEqual(oid2.toHexString(), oid1.toHexString()); | ||
values.forEach(v => { | ||
let oid = ObjectId.createFromTime(v); | ||
realm.write(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not have the realm.write wrap the forEach
What, How & Why?
Updating to latest core/sync/object store and adding more testing. Related to:
The
Decimal128
tests will fail as outlined in realm/realm-core#3679☑️ ToDos
[ ] 📝Compatibility
label is updated or copied from previous entry[ ] 📝 Public documentation PR created or is not necessary[ ] 💥Breaking
label has been applied or is not necessaryIf this PR adds or changes public API's:
[ ] typescript definitions file is updated[ ] jsdoc files updated[ ] Chrome debug API is updated if API is available on React Native