Commit Graph

642 Commits

Author SHA1 Message Date
Kenneth Geisshirt d52121f290 make it fail 2017-09-27 11:22:46 +02:00
Kenneth Geisshirt 20defad505 Merge branch '2.0.x' of github.com:realm/realm-js into fix-accountInfo-2.0 2017-09-27 10:01:20 +02:00
Thomas Goyne c9a3548f32 Add some missing property type validation 2017-09-26 14:43:44 -07:00
Thomas Goyne fbf5da388b Make an error message test less specific to accomodate platform differences 2017-09-26 13:43:01 -07:00
Thomas Goyne 9a31febc4c Add support for lists of things other than objects
And add a shorthand syntax for schema definitions.
2017-09-26 11:40:22 -07:00
Thomas Goyne 54bbc708e9 Create a global named `global` when running JSC tests 2017-09-26 11:40:22 -07:00
Thomas Goyne 18dea2bc6c Add an equality assertion that does the right thing for a given property type 2017-09-26 11:40:22 -07:00
Thomas Goyne 0167e60142 Add support for choosing what stack depth to report in test failures
This gives a much more useful test failure message when an assertion is called
from within a function.
2017-09-26 11:40:22 -07:00
Yavor Georgiev c3b56c1183
testing 2017-09-26 15:18:14 +02:00
Thomas Goyne 2298609ce5 Merge remote-tracking branch 'origin/master' into tg/merge-master-to-2.0.x
* origin/master: (23 commits)
  Fix api doc error
  fix progress notifications registrations
  Fix typo in Github issue template
  Fix port conflict between RN >= 0.48 and RPC server (#1294)
  Disable testAddListener when running in chrome
  Ensure RN has an event loop running for async tests
  Make permission tests better handle server delays
  Fix race conditions in testAddListener
  Separate build and test steps in xcode to reduce chance of hitting "Early unexpected exit"
  Ignore errors when sourcing nvm.sh
  Don't forward arguments to nvh.sh
  Skip sourcing nvm.sh if it's already available
  Fix some shellcheck warnings
  Ensure node 6.5.0 is installed on CI
  Build realm from source for each test-runner test
  Improve error reporting for incorrect argument counts for Realm methods
  Use the same error messages in the RPC code as the regular code
  Silence an unused variable warning when building with sync disabled
  Check the exception message in all Realm tests which assert an exception is thrown
  Don't discard the actual error message in validated_get_X
  ...
2017-09-25 09:40:56 -07:00
Kenneth Geisshirt a717b291e8 Merge branch '2.0.x' of github.com:realm/realm-js into kneth/v1_v2-upgrade 2017-09-23 00:18:42 +02:00
Kenneth Geisshirt 39fe8c6280 Creating a proper IncompatibleSyncedRealmError class. 2017-09-23 00:05:33 +02:00
blagoev eed5395c99 Enable all tests except permissions 2017-09-22 20:25:37 +03:00
blagoev a88463bb18 fix users tests 2017-09-22 20:22:17 +03:00
Kenneth Geisshirt 4b2acf3b79 Updating documentation and test. 2017-09-22 13:50:17 +02:00
Thomas Goyne 086f31c07f Use the objectstore keypath sorting functionality
Adds support for sorting on values over links, reduces the amount of code in
the binding, and is required for sorting non-object lists.
2017-09-21 10:41:19 -07:00
blagoev 4f5e51430c Test 2.0.x on CI 2017-09-21 15:41:00 +03:00
blagoev 749c88ec74 Uncomment tests (now that they are guarded by a Fixme) 2017-09-21 02:38:22 +03:00
blagoev 3f7e693a26 Download ROS 2.0 from npm for testing
disabled permissions and account tests
2017-09-21 02:22:49 +03:00
Thomas Goyne 1490285483 Skip running tests against ROS until they are updated for 2.0 2017-09-21 02:09:05 +03:00
blagoev 0f1d916874 fix users tests (account tests still fail) 2017-09-21 01:43:08 +03:00
blagoev b7fef1b6e9 Fix tests 2017-09-21 01:43:08 +03:00
blagoev 3ee26d5719 fix error reporting 2017-09-21 01:43:08 +03:00
blagoev ac6a39728a Fix admin-user-helper for ROS 2.0 2017-09-21 01:43:08 +03:00
Kenneth Geisshirt d9e50fc41d better name for test 2017-09-20 14:53:28 +02:00
Kenneth Geisshirt bdd9bf95f4 use local Realm 2017-09-20 09:26:30 +02:00
Thomas Goyne c3afa0c301 Disable testAddListener when running in chrome 2017-09-19 16:06:45 -07:00
Thomas Goyne 41440125cb Ensure RN has an event loop running for async tests 2017-09-19 15:45:07 -07:00
Thomas Goyne e8e23bbee7 Make permission tests better handle server delays
Retry a few times if the request hasn't been processed yet rather than hoping
that a 100ms sleep will suffice.
2017-09-19 13:14:49 -07:00
Thomas Goyne 8ad5c36cca Fix race conditions in testAddListener
The test was resolving the promise long before it actually finished running,
leading to it not testing what it was trying to test and sometimes crashing.
2017-09-19 10:57:01 -07:00
Kenneth Geisshirt e68d68168b test file 2017-09-19 14:16:58 +02:00
Kenneth Geisshirt abe0781565 Encode exception type and path in string 2017-09-19 14:16:15 +02:00
Kenneth Geisshirt c3b81c768d wip 2017-09-19 11:31:58 +02:00
Kenneth Geisshirt eeb78d8e1b Merge branch 'master' of github.com:realm/realm-js into 2.0.x 2017-09-18 09:46:36 +02:00
Thomas Goyne 0c9d7ca54e Improve error reporting for incorrect argument counts for Realm methods
Report the expected and actual arg counts for too many arguments, and behave
more like normal JS when too few are supplied (i.e. complain about the next
argument being undefined rather than just saying 'Invalid arguments').
2017-09-15 15:00:13 -07:00
Thomas Goyne 53ca09839e Check the exception message in all Realm tests which assert an exception is thrown 2017-09-14 16:40:58 -07:00
Kenneth Geisshirt 8606d37141 Fixes to issues reported by eslint (#1313) 2017-09-14 10:35:02 +02:00
astigsen 208aa8ee46 Added support for in-memory realms (#1304)
* Added support for in-memory realms
2017-09-13 20:42:23 +02:00
blagoev 03bc224374 Merge pull request #1302 from realm/blagoev/promise3
Blagoev/promise3
2017-09-13 15:07:53 +03:00
blagoev 064b487c07 Merge branch 'master' into blagoev/promise3 2017-09-13 14:27:04 +03:00
blagoev 8ba71e36c7 add typescript definition compilation checks on every test run 2017-09-13 12:59:13 +03:00
blagoev f7db865458 Fix typescript definitions
Fixes #1306
2017-09-13 12:37:44 +03:00
blagoev 1f5b98bb53 Use promisified methods for login and register to have backward compatibility testing as well 2017-09-12 23:08:54 +03:00
blagoev b58e9094da output the error as it is in download-api-helper 2017-09-12 23:04:46 +03:00
blagoev 9366de14ef Revert user-tests to still use callbacks for login/register etc 2017-09-12 23:01:58 +03:00
Maximilian Alexander 78515e3b48 adding promisified apis 2017-09-12 20:10:52 +03:00
Ashwin Phatak 532f517ded Add Realm.deleteModel API (#573) 2017-09-12 14:45:36 +05:30
blagoev 4d1762025f Fix possible sporadic test failure 2017-09-12 11:21:15 +03:00
blagoev f2ea9e849b readability 2017-09-11 15:50:44 +03:00
blagoev e1cebe073a add progress notifications api 2017-09-11 15:50:44 +03:00
blagoev 3f3186ee84 Fix debugger detection for newer nodejs versions >= 7 2017-09-11 15:50:44 +03:00
blagoev 22aaeedd3b Enable download-api-helper to be started for existing user 2017-09-11 15:50:43 +03:00
Kenneth Geisshirt 356033a8c4 Merge branch 'tg/update-object-store' of github.com:realm/realm-js into 2.0.x 2017-09-08 14:56:01 +02:00
Kenneth Geisshirt fa0016ba6b Merge branch 'master' of github.com:realm/realm-js into 2.0.x 2017-09-08 14:54:56 +02:00
Ashwin Phatak 119cd79e5d Add Realm.deleteFile API (#363) 2017-09-07 10:12:59 +05:30
Thomas Goyne 9a434e502a Improve error reporting on test failures a little 2017-08-31 16:43:25 -07:00
Thomas Goyne c06daa795e Add missing files to the xcode project 2017-08-31 16:43:25 -07:00
Thomas Goyne 736277084e Fix creating admin token users 2017-08-31 13:49:45 -07:00
Thomas Goyne ce749578e1 Fix error reporting from admin-user-helper.js
In some cases errors were not being bubbled out correctly.
2017-08-31 13:49:45 -07:00
Thomas Goyne 886949472d Fix a test which tried to use a bool primary key 2017-08-31 13:49:45 -07:00
Thomas Goyne cb9a3c9f76 Add the invalid value to the type error exception message 2017-08-31 13:49:45 -07:00
blagoev f5a940fd0c Fix admin-user-helper 2017-08-29 15:23:49 -07:00
Kristian Dupont 402bf48f88 Permissions api (#1244)
* Add basic permissions skeleton

* ...

* Update permissions api

* Wait for server to process management realm, add offer api

* Fix test of apply and get permissions, add offer test

* Accept permission offer

* Accept permission offer test

* Invalidate permission offer

* Add basic docs (still need some links etc)

* Refactor tests

* Only run permission tests where sync is enabled

* Use legal syntax for user name generation

* Add changelog entry

* Streamline permission tests

* Fix casing for access level names etc.

* Add basic definitions to index.d.ts

* Use settimeout for resolving promise from listener

* Complete typescript defs

* Improve docs

* Allow 'any' as default recipient in getGrantedPermissions

* Fix getSpecialPurposeRealm on iOS

* Response to PR comments

* Respond to PR comments

* Fix offer description

* Skip permission tests in chrome debugger :-/
2017-08-29 15:23:22 +02:00
Kenneth Geisshirt 85fb49b354 Adding methods and property to manually control write transactions (#1216)
* Adding methods and property to manually control write transactions
2017-08-21 17:48:53 +02:00
Kenneth Geisshirt bd28c05936 Add shouldCompactOnLaunch option to configuration (#1209)
* Adding shouldCompactOnLaunch option to configuration
* Adding Realm.compact()
2017-08-18 14:22:29 +02:00
Yavor Georgiev 614c699385 [2.0.0-rc4] Bump version 2017-08-17 13:21:34 +02:00
Yavor Georgiev 5db836dc8b use newest ROS 2017-08-17 13:02:21 +02:00
Yavor Georgiev c78f82ac0c Update download script for the new core build system 2017-08-17 13:01:41 +02:00
Kenneth Geisshirt 1dd85b591a Merge pull request #1190 from ejoy-jsc/master
correct testProgressNotificationsForRealmOpen
2017-08-16 14:56:14 +02:00
Kræn Hansen e4e1431c55 Running js tests in Electron renderer process (#1196)
* First take on running the tests inside an Electron render process

* Making progress

* Making it possible to override the location of the admin token

* Ignoreing the realm-object-server files

* Fixing a console.log to return a string instead of a boolean

But it should probably be removed entirely

* Making the downloaded ROS log less

* Adjusting comments in the test.sh

* Checking number of windows to determine an Electron crash

* Added a test that triggers garbage collection of ArrayBuffers

* Enabled the ability to run the tests in Electrons main process

* Run tests first in main process and the render

* Added a README.md that documents how Electron tests can be run

* Added a comment on why the garbage-collection test was added.

* Waiting with reading the admin token, until it is actually used

* Disabling the GarbageCollectionTests for now
2017-08-11 10:30:57 +02:00
Kristian Dupont bb3411f7f7 Fix Object.setPrototypeOf issue on Android (#1195)
* Fix Object.setPrototypeOf issue on Android

* Fix prototype chain
2017-08-09 15:08:19 +02:00
toanz 7d903cc96e correct testProgressNotificationsForRealmOpen
ProgressNotifications is not working , this test is incorrect
2017-08-07 10:28:01 +07:00
Yavor Georgiev 5dd9264225
Add `Realm.empty` 2017-07-12 13:02:21 +02:00
Yavor Georgiev ab29ac4490 Fix linter issues (#1132) 2017-07-10 16:53:00 +02:00
Mark Rowe 89149c0a75 Make it possible to assign a List or Results to a List property once more (#1126)
* Make it possible to assign a List or Results to a List property.

The change made in #1069 to improve error messages when values of
incorrect types were assigned to a given property was being too
narrow in the types it accepted for list properties, allowing only
arrays. Lists and Results are now accepted once more.

* Update CHANGELOG.md
2017-07-10 13:45:49 +02:00
blagoev 516c39deaf Docs for retrieveAccount method (#1127)
* Docs for retrieveAccount method

* fix setTimeout call
2017-07-08 19:30:25 +02:00
blagoev 709ebd4dd5 Use objectForPrimaryKey 2017-07-07 16:44:54 +03:00
blagoev 9ea5dd7f8c address review comments 2017-07-07 16:38:13 +03:00
blagoev d5d6638975 fix RN tests 2017-07-07 13:54:58 +03:00
blagoev 6a284c94b1 don’t run retrieveAccount tests on RN 2017-07-07 12:46:57 +03:00
blagoev 4a499464eb Run admin helper on node only 2017-07-07 12:43:02 +03:00
blagoev 9c63858d29 fix admin-user-helper and enable retrieveAccount tests 2017-07-07 12:16:12 +03:00
blagoev ee452963c2 Disable user lookup tests temporary 2017-07-07 10:31:29 +03:00
blagoev e31529397f Add tests for retrieveAccount method
fix admin-user-helper wait for admin to correctly wait
2017-07-07 10:31:29 +03:00
blagoev 5cbfd540f1 add script for creating test admin user 2017-07-07 10:31:29 +03:00
blagoev 8d9896d04a Merge branch 'master' of http://github.com/realm/realm-js 2017-06-29 14:28:15 +03:00
blagoev 30ad678dfa rename test variable to reflect parameter meaning 2017-06-29 14:28:08 +03:00
Marius Rackwitz 9e0a9a3bd3 Add support for accessing linking objects / backlinks (#1101)
* Add support for linkingObjects

* Test linkingObjects

* Borrow names helper from list tests

* include computed properties when serializing the schema for the RN debugger

* add API docs

* review comments

* Expose admin users to JS (#1100)

The JS binding used to conflate `SyncUser::is_admin()` with the user being created by calling `Realm.Sync.User.adminToken()`, but now that we expose a user’s role on the server under `is_admin()` this supposition is no longer correct.

#1097 attempted to fix one such case, but fixing it only uncovered another: in `UserClass<T>::all_users()`.  I’ve gone through all the callsites of `SyncUser::is_admin()` to make sure they don’t assume an admin token user.

* [1.8.3] Bump version

* add linkingObjects method to Realm.Object

* changelog
2017-06-29 11:59:10 +02:00
blagoev f54487c6cc Rename the progress function to better reflect purpose
refactored registration code to remove the unneccesary lambda
2017-06-28 15:02:28 +03:00
blagoev 55542a492e refactor code that runs helper out of process
as per review comments
2017-06-28 13:40:35 +03:00
blagoev 97f25cc1ab Add progress notifications
Support download progress notifications for Realm open and openAsync methods
2017-06-28 13:40:35 +03:00
astigsen db4e184524 Added method to find index of object in collections (#1094)
* Added method to find index of object in collections

* rework as the indexOf method
2017-06-26 13:43:49 +02:00
Yavor Georgiev 7086ed745f Do not throw when the Sync constructor isn’t there (#1086)
* Do not throw when the Sync constructor isn’t there

with unified packaging it’s there all the time now

Closes #1084
Fixes #996

* Fix running the sync tests when Sync is disabled
2017-06-20 15:40:54 +02:00
Mark Rowe 30e58022cf Include property names in type error exceptions thrown by Realm.create (#1069)
* Add and adopt `Value::is_binary` / `Value::to_binary` / `Value::from_binary`.

These methods allow conversions between `BinaryData` and the equivalent
JavaScript types without using `NativeAccessor`. Instead,
`NativeAccessor` now itself delegates to these methods.

* Have `NativeAccessor::value_for_property` and `RealmObjectClass::set_property`
verify that values are valid for the property in question.

If not, we throw an exception that includes the name and type of the
property in question.

`NativeAccessor` is changed to always hold a reference to a `Realm` and
an `ObjectSchema` in order to make this validation possible.

* Fix the Windows build.

* Remove an unused, incorrect forward declaration of a template class
  named `Realm` that caused ambiguity with object store's `Realm` class.
* Disambiguate between `realm::js::PropertyType` and
  `realm::PropertyType`.

* Update CHANGELOG.md
2017-06-20 14:40:01 +02:00
Adam Fish 37dba6bb36 Add objectSchema method to Realm Object (#1055)
* Add objectSchema property to Realm Object

* fix
2017-06-20 11:42:43 +02:00
Yavor Georgiev 28fe678a1b Use an uncached realm instance for _waitForDownload (#1083)
Fixes #1061
2017-06-19 13:58:19 +02:00
blagoev aab7171643 add test for working with local realms with async open api 2017-05-19 09:18:48 +03:00
blagoev ea7b10191a Add test for async open api with no schema usage 2017-05-19 08:59:03 +03:00
blagoev ebb8d8efa6 Revert "reverted the debugger attached timeout change that might be causing CI to hang"
This reverts commit c019ffc33a.
2017-05-17 16:23:49 +03:00
blagoev c019ffc33a reverted the debugger attached timeout change that might be causing CI to hang 2017-05-17 16:18:56 +03:00