Commit Graph

290 Commits

Author SHA1 Message Date
Scott Kyle c34990759d Add test that checks schema validation 2016-01-05 13:54:03 -08:00
Scott Kyle 9be1331dbf Convert tests to create objects with property objects
This makes it more readable and will be the preferred syntax in the documentation (and is much less likely to be deprecated in the future!).
2016-01-05 13:54:03 -08:00
Scott Kyle 43e14093cc Change schema API to take properties as an object
The keys are names of the properties, which is more natural in JS, but will cause issues with ability to create objects where arrays of values. This feature will be removed in a subsequent commit.
2016-01-05 13:40:57 -08:00
Scott Kyle 381dbbe7ba Merge branch 'sk-npm'
* sk-npm:
  Add ability to publish NPM module to git
  Move RealmJS.mm to correct location
2016-01-05 13:25:20 -08:00
Scott Kyle 2bfedc5d8a Merge branch 'sk-project-cleanup'
* sk-project-cleanup:
  Fix for failing React tests
  Rename JS test files to be consistent
  Cleanup and fix resolving JS test files
  Cleanup source groups in Xcode project
  Move RealmJS.mm to correct location
2016-01-05 13:19:02 -08:00
Nabil Hachicha 98cb634a36 using dynamic linker to expose s_globalContextRefToJSCExecutor 2016-01-05 11:08:42 -08:00
Nabil Hachicha 8965aa80f7 fixed example, add Relinker to load JNI lib 2016-01-05 11:08:42 -08:00
Ari Lazier eea8658627 put our react module in our aar 2016-01-05 11:08:42 -08:00
Ari Lazier 15ad6a12ac remove duplicate project 2016-01-05 11:08:42 -08:00
Ari Lazier 8cb8b0729a move library to separate project 2016-01-05 11:08:42 -08:00
Nabil Hachicha 28d1f92a7e add Demo project based on the built realmreact lib 2016-01-05 11:07:21 -08:00
Ari Lazier 1fa0098158 empty implementations for platform methods 2016-01-05 11:07:21 -08:00
Ari Lazier 8104738e1a use gcc 2016-01-05 11:07:21 -08:00
Ari Lazier 468337263c link static library 2016-01-05 11:05:56 -08:00
Emanuele Zattin b37d0093b3 Some small random fixes.
Now it gets stuck not being able to find pegtl.hh,
which is nowhere to be seen in the repo.
2016-01-05 11:05:56 -08:00
Ari Lazier ee341c4fe7 try to use realm core so's (which don't exist yet) 2016-01-05 11:05:44 -08:00
Ari Lazier 3c5a35640c try to download core 2016-01-05 11:05:44 -08:00
Ari Lazier d76b77111a fix for demangle missing 2016-01-05 11:05:44 -08:00
Ari Lazier 50ecaa3b22 just use one symlink to the binding source, make more stuff compile 2016-01-05 11:05:44 -08:00
Ari Lazier 3aaf988953 fixes 2016-01-05 11:05:27 -08:00
Nabil Hachicha c3d5fd4e09 add Core include + fix c++14 issue 2016-01-05 11:04:06 -08:00
Ari Lazier 2974d87560 fix imports 2016-01-05 11:04:06 -08:00
Nabil Hachicha 5b06c41163 adding module deps + fixing gradle 2016-01-05 11:04:06 -08:00
Ari Lazier d7ca354a27 add makefile 2016-01-05 11:04:06 -08:00
Ari Lazier 3cd60002ba add symlinks to binding source 2016-01-05 11:04:06 -08:00
Scott Kyle 632f9d737e Add methods to create snapshot of List and Results
The Results class was updated to match the style of List and include a flag (m_live) that determines if it should sync updates. If an object in the static Results is deleted, then it will return null.
2015-12-30 16:53:26 -08:00
Scott Kyle 3739fab57f Fix for failing React tests
Since the JS test modules have been renamed to have consistent naming, we add a method to actually run the test methods to use our existing abstraction.
2015-12-30 16:47:16 -08:00
Scott Kyle b3a0627a51 Rename JS test files to be consistent 2015-12-29 14:56:38 -08:00
Scott Kyle 6776eef6c0 Cleanup and fix resolving JS test files
The whole lib folder is now copied into the test bundle and the correct path to where a failure occurred is now properly resolved.
2015-12-29 14:55:20 -08:00
Scott Kyle 3da6b54df6 Add ability to publish NPM module to git
The top-level package.json explicitly includes the directories it needs (vendor/.npmignore cuts down the cruft). The publish-beta.sh script essentially uses `npm pack` to package up the NPM module and then push it into an orphaned `beta` branch.
2015-12-28 22:01:17 -08:00
Ari Lazier 4c402a7daf install from test script 2015-12-15 18:18:18 -08:00
Ari Lazier 2476c061c1 npm install react-native if out of date 2015-12-15 18:02:20 -08:00
Scott Kyle 1f2eabeb1a Update to use React Native 0.16
Outside of the ReactExample test, no backwards incompatible changes were needed.
2015-12-08 16:59:12 -08:00
Scott Kyle 1231a45780 Merge pull request #177 from realm/sk-code-sign-fix
Fixes for running apps on device
2015-12-08 12:57:46 -08:00
Scott Kyle 4109c86343 Make Realm object properties enumerable 2015-12-08 03:26:57 -08:00
Scott Kyle 7a54b0a256 Merge pull request #176 from realm/sk-rpc-list-fix
Fix RPC client error after deleting objects
2015-12-04 12:24:10 -08:00
Scott Kyle 25cfb68779 Remove use of explicit target dependencies
The target dependencies are discovered implicitly, and removing the use of explicitly defined dependencies actually resolved a very odd bug with Xcode when building ReactExample.app for a device.
2015-12-02 17:45:09 -08:00
Scott Kyle e643fd9e3a No longer code sign RealmReact.framework on copy
Doing so causes its embedded frameworks to lose their code signatures, which in turns means the dynamic linker will refuse to load them on device.
2015-12-02 17:45:09 -08:00
Scott Kyle be0c2a91ea Fix RPC client error after deleting objects
Specifically for objects with lists, since the mutation listener would fire on a list that no longer is attached. If during the mutation listener that error is thrown, then the listener will be removed and the error will not be propagated.
2015-12-01 14:05:33 -08:00
Scott Kyle 1f64573b4e Update to support React Native 0.15.0
Resolves #173
2015-11-30 18:08:51 -08:00
Ari Lazier 564181a887 clean up header search paths 2015-11-30 12:14:50 -08:00
Ari Lazier 5d1e9d4dd3 pr fixes 2015-11-30 11:47:32 -08:00
Ari Lazier 5f584f747f use underscore rather than dash 2015-11-30 11:23:29 -08:00
Ari Lazier 70edb99e5e update android test app 2015-11-30 11:23:29 -08:00
Ari Lazier 17b693877d add android test app 2015-11-30 11:23:29 -08:00
Ari Lazier eb44b27633 move everything/rename to make room for android 2015-11-30 11:23:29 -08:00
Ari Lazier cdb254ca44 tests for keypath queries 2015-11-29 18:56:50 -08:00
Ari Lazier fbb1f42c6e don't merge predicate to negated and group 2015-11-25 18:32:13 -08:00
Ari Lazier 812930285e compount parser tests 2015-11-24 10:39:42 -08:00
Ari Lazier dc62cbe52a fixes for packager and npm version for react tests 2015-11-23 19:07:50 -08:00
Ari Lazier 9ea8ab25c5 pr feedback 2015-11-23 08:47:09 -08:00
Ari Lazier ae5e4d82b8 fixes for remaining warnings 2015-11-20 19:50:58 -08:00
Ari Lazier df7474feb3 run parser tests in RealmJSTests 2015-11-20 15:16:35 -08:00
Ari Lazier 40f0e5f274 move queryTests to parser dir 2015-11-20 14:51:04 -08:00
Ari Lazier 494fbd3a06 object tests 2015-11-20 14:14:35 -08:00
Ari Lazier 22ca94e36e test and bug fixes for data queries 2015-11-19 15:17:57 -08:00
Ari Lazier 3a9137fa08 put tests in JSON 2015-11-19 14:36:42 -08:00
Ari Lazier aa3bad1a69 more string tests and bugfix 2015-11-19 13:05:37 -08:00
Ari Lazier 7be7d330ac more string tests 2015-11-19 13:05:37 -08:00
Ari Lazier be93d3dd58 first string tests and custom error messages 2015-11-19 13:05:37 -08:00
Ari Lazier a64fab83ad make test cases json 2015-11-19 13:05:37 -08:00
Ari Lazier d7d328d2fe finish numeric tests 2015-11-19 13:05:37 -08:00
Ari Lazier b2f682b94b more int tests 2015-11-19 13:05:37 -08:00
Ari Lazier e449f10fcc some int tests 2015-11-19 13:05:37 -08:00
Ari Lazier 20ac833e41 bool tests 2015-11-19 13:05:37 -08:00
Ari Lazier b6970906e0 JSON test cases 2015-11-19 13:05:37 -08:00
Ari Lazier 5784bbe6ed start porting over objc query tests 2015-11-19 13:05:37 -08:00
Ari Lazier f402a45a40 change argument syntax to use $ instead of {} 2015-11-19 13:05:37 -08:00
Ari Lazier f3d7855c99 test and fix for date queries 2015-11-19 13:05:37 -08:00
Ari Lazier 3a198ec507 support query format strings 2015-11-19 13:05:37 -08:00
Ari Lazier 3b698400b7 support for querying boolean properties 2015-11-19 13:05:37 -08:00
Ari Lazier d8c89c7098 support for truepredicate/falsepredicate, single quote strings - all tests now pass 2015-11-19 13:05:37 -08:00
Scott Kyle 7b115a934b ArrayBufferView objects now fully supported
Previously we were not accounting for the byte offsets and misunderstood how the Uint8Array constructor worked. The tests now confirm everything works as expected with multiple different typed arrays and slices of the data.
2015-11-17 13:32:32 -08:00
Scott Kyle 7f32ab0b88 Improve JS test assertion failure messages
Only the first line is shown in Xcode, so we just a dash to separate the custom message from the helpful one provided by the assertion instead.
2015-11-17 13:32:32 -08:00
Scott Kyle 3bf84a1b6f Update data properties to return ArrayBuffers
As a convenience, the setters will take typed Arrays (e.g. Uint8Array) since that is a common representation of data in JS (as they are "views" of ArrayBuffer objects).

The tests have been updated to reflect this new behavior.
2015-11-17 13:32:31 -08:00
Ari Lazier 283826e687 support latest version 2015-11-13 10:13:33 -08:00
Ari Lazier 5b29f09e7a don't require any GCDWebServers dependency when building Release 2015-11-11 15:37:03 -08:00
Scott Kyle 5320df9a5f Merge pull request #116 from realm/sk-realmjs-api
Create API that returns constructor JSObjectRef
2015-11-03 16:39:08 -08:00
Scott Kyle 2f4bcee5ce Update test to ensure unique listener callback behavior 2015-11-03 14:45:06 -08:00
Scott Kyle aff11983f3 Create API that returns constructor JSObjectRef
Resolves #98
2015-11-02 22:51:33 -08:00
Scott Kyle 8cb7e43e2e Merge pull request #115 from realm/sk-fix-chrome-tests
Re-enable chrome tests
2015-11-02 17:00:11 -08:00
Scott Kyle 84b419c815 Fix to run RealmReactTests with release builds
In the case of a release build, React Native will not include the RCTWebSocketExecutor.
2015-11-02 15:20:49 -08:00
Ari Lazier 6c6931a97d enable chrome tests 2015-11-02 13:50:16 -08:00
Scott Kyle 7181a00f01 Fix to make RealmReact tests work in Chrome again
Left the RealmReactChromeTests commented out for now until it's confirmed to work in the CI environment.
2015-11-02 13:38:00 -08:00
Scott Kyle aa55b61b86 Update React Native to 0.13.2 2015-11-02 13:38:00 -08:00
Ari Lazier 87b2c0f6c4 basic tests for null objects during upsert 2015-11-02 13:30:42 -08:00
Ari Lazier 196a0a15a4 allow setting nullable properties to undefined 2015-11-02 10:08:23 -08:00
Scott Kyle 0b35564830 Merge pull request #107 from realm/sk-live-update-fixes
Ensure Lists and Results live-update in Chrome
2015-10-28 10:46:43 -07:00
Scott Kyle d5d05c5d15 Add comments to test to explain canceling transaction 2015-10-28 10:45:42 -07:00
Scott Kyle b38b87e2f4 Add beta license to ReactTests index.ios.js 2015-10-28 10:40:07 -07:00
Scott Kyle 0eb3b49970 Ensure Lists and Results live-update in Chrome
Results needed to live-update during a transaction (not just as the end), and Lists needed to update on deletions as well.
2015-10-28 10:21:32 -07:00
Ari Lazier 841f45a7b2 change the license before starting the beta 2015-10-27 14:15:21 -07:00
Ari Lazier fd1ebf0aa0 remove extra newline 2015-10-27 13:45:37 -07:00
Ari Lazier 18d65471be fix and tests for setting null properties 2015-10-27 12:13:57 -07:00
Ari Lazier ac1cdfdc8b support null for basic propety types 2015-10-27 12:13:57 -07:00
Ari Lazier fc631c3e6f wont work until we have propery object store support 2015-10-27 12:13:57 -07:00
Scott Kyle 0511bade62 Non-existent object getters shouldn't throw exceptions 2015-10-27 09:39:52 -07:00
Ari Lazier a1c4cd5702 pr fixes 2015-10-27 07:48:11 -07:00
Ari Lazier 6f41c3cf68 take notification name 2015-10-26 19:18:24 -07:00
Ari Lazier 6f57500972 change notification name to change 2015-10-26 16:19:12 -07:00
Ari Lazier 246ccc7bde add other notification methods 2015-10-26 16:15:46 -07:00
Scott Kyle 9cfcc2ea9e Fix for running RealmReactTests in release mode
The RTCDevMenu is missing the `moduleName` class method in release mode.
2015-10-26 14:57:50 -07:00
Scott Kyle 32ebd7f218 Remove RCTTest linkage from ReactTests and ReactExample
This module has build errors with Release configuration and is not necessary. When in Chrome debugging mode, a warning will be issued about missing the RCTSnapshot module though, which is why we linked against it in the first place.
2015-10-26 14:57:06 -07:00
Scott Kyle a2cd949e09 Prevent tests from ever opening Chrome
The test is commented out for now.
2015-10-26 13:25:15 -07:00
Scott Kyle 0843d69a4f Expose RealmJS API as C functions
We're still using Objective-C to delete test files, so we can't rename the implementation file quite yet.
2015-10-26 01:14:33 -07:00
Scott Kyle 4d73c13466 Merge branch 'sk-chrome-xcode-tests'
* sk-chrome-xcode-tests:
  Actually report test failures when running in Chrome
  Change RealmReactTests to run with both executors
  Fix RealmReactTests to work through Chrome
  Use a default to override Chrome debugging setting
  Change ReactTests project to 4 space indentation
2015-10-23 16:38:17 -07:00
Scott Kyle 1ede355b78 Actually report test failures when running in Chrome
Turns out Chrome doesn't report back exceptions, but instead does pass back an array of five empty arrays (I am not kidding).
2015-10-23 14:13:38 -07:00
Scott Kyle e7b05d2dc6 Change RealmReactTests to run with both executors
A new approach was needed for this. The RCTDevMenu is disabled so that it doesn't interfere with us changing the executor class. A suffix is added to the name of test cases that are run in Chrome.
2015-10-23 14:12:35 -07:00
Ari Lazier 92a9113ef6 get it to compile 2015-10-22 15:31:26 -07:00
Scott Kyle 2fe1f0d26e Fix RealmReactTests to work through Chrome
The key idea was the cycle the runloop once after receiving the RCTJavaScriptDidLoadNotification so that the RCTDevMenu could also handle that notification and setup the bridge properly, as well as not block the main thread by spinning the runloop instead.
2015-10-22 02:49:15 -07:00
Scott Kyle 6a8fa75a37 Use a default to override Chrome debugging setting
This is done in a way that does not override the persistent user defaults. You set this default when launching the app by supplying `-RealmReactEnableChromeDebugging YES/NO` launch arguments.
2015-10-22 02:47:10 -07:00
Scott Kyle 56ad4faa19 Change ReactTests project to 4 space indentation
Also changed copyright notice.
2015-10-22 02:34:46 -07:00
Ari Lazier ac544205a1 test setting all primitive types to null/undefined throw 2015-10-21 23:06:39 -07:00
Ari Lazier 08a84bd8e9 cleanup scheme and target names 2015-10-21 19:20:45 -07:00
Scott Kyle bd2d1559d1 Error when assigning to Result index or length
Added some tests. Turns out our Chrome layer already did this too, so no changes were needed there.

Resolves #70
2015-10-21 15:25:53 -07:00
Scott Kyle d50e3ae68c Add Object.keys test for Results 2015-10-21 15:21:17 -07:00
Scott Kyle d55d42da8d Add ESLint config for JS test files
This helps the editor catch simple syntax issues before finding out about them when running a test.
2015-10-21 15:20:44 -07:00
Scott Kyle 8ba3a24eae Move RealmJSCoreTests.m to tests directory
Test failures were not pointing to the correct JS file path when it was in the src directory. This is where it belongs anyways.
2015-10-21 15:18:47 -07:00
Scott Kyle 36382ecb56 Add instanceof test for Results 2015-10-21 15:17:55 -07:00
Scott Kyle 7acd4d89c1 Update ReactTests project to React Native 0.13.0-rc 2015-10-21 13:57:34 -07:00
Scott Kyle 0055d0510c Make List objects work with Object.keys in Chrome
Rather than using Object.preventExtensions to throw exceptions when setting any out-of-bounds index, we must instead compromise by only throwing for the common cases, which are -1 and list.length. Having Object.keys() support is essential for List to work with React Native ListViewDataSource.

Resolves #80
2015-10-21 13:11:41 -07:00
Ari Lazier cfd618db32 flag to create jscontext 2015-10-19 11:28:50 -07:00
Ari Lazier 5ccc03eeb7 rename some methods for clarity - try to cleanup js objects 2015-10-15 18:48:13 -07:00
Scott Kyle 5d59431860 Fix crash when a test fails inside RealmReactTests
This also appears to fix crashes when running ReactTests with Chrome debugging enabled!

The crash when tests failed was due to JavaScriptCore trying to create a backtrace with the native call stack.
2015-10-15 16:18:58 -07:00
Scott Kyle 7f5902b021 Remove dependency on JavaScriptCore for RealmReactTests
The test structure is now provided by a JS API, that is used by all things that run tests. Also, the tests can be run manually by tapping a button in the ReactTests app.
2015-10-15 15:19:59 -07:00
Scott Kyle 7a79ac8803 Make Xcode tests run in React environment
The deleteTestFiles() function is now added to the Realm object, so that it's easy for the RPC module to handle this as well. We can only do this in testing environments in the future.
2015-10-15 03:26:56 -07:00
Ari Lazier 7b5be78df2 close to working test harness 2015-10-14 18:52:55 -07:00
Ari Lazier e470c5d189 run tests from subclass 2015-10-14 15:46:46 -07:00
Scott Kyle c8c1910910 Expose global cleanupTestRealms function
This handles clearing out all of the test files between each test case.
2015-10-14 15:26:05 -07:00
Ari Lazier d0787e36bb remove android project 2015-10-14 15:19:44 -07:00
Ari Lazier 2384f2cf9b catch errors thrown from tests and display error information 2015-10-14 15:15:44 -07:00
Scott Kyle 39b262b279 Each test can now have a beforeEach and afterEach 2015-10-14 15:02:19 -07:00
Scott Kyle dc84ac63b6 Merge branch 'sk-react-framework' into sk-test-suite
* sk-react-framework: (27 commits)
  Change RealmReact to be a dynamic framework
  finish Array to List rename
  RJSArray -> RJSList
  move property getters to object store code
  move List class to its own file
  ObjectArray -> List
  Add Notification constructor and destructor
  Small improvement to notifications test
  RJSException no longer requires JS strings
  Protect realm and callback from GC in addNotification
  Add comments
  pr fixes
  minimal tests for migrations
  Check for NaN inside RJSValidatedValueToNumber
  allow running all tests at the same path by invalidating all cached realm paths between test runs
  Native methods should convert to numbers/bools
  Out of bounds getters for Results return undefined
  Out of bounds list item getters return undefined
  Consolidate code that verifies array index bounds
  Add list item setters in JS
  ...
2015-10-14 02:12:50 -07:00
Scott Kyle 9916fe14a4 Change RealmReact to be a dynamic framework
It embeds RealmJS and GCDWebServers frameworks. This fixes #58, where there were issues with building for devices rather than just the simulator.

Some changes were made so that RealmReact.m didn't need to be weakly linked to libReact.a since that would actually cause any executable that uses this framework from being able to compile with bitcode.
2015-10-14 02:05:02 -07:00
Ari Lazier 4cf19d0e87 Merge pull request #60 from realm/al-os
First pass at object_store refactor
2015-10-13 17:16:27 -07:00
Ari Lazier f6e0d34022 RJSArray -> RJSList 2015-10-13 15:27:24 -07:00
Scott Kyle 6a550f285f Small improvement to notifications test 2015-10-12 23:19:54 -07:00
Ari Lazier f4715da2a4 Merge pull request #55 from realm/al-migrations
Minimal migration tests - use same path for all tests
2015-10-12 17:26:51 -07:00
Ari Lazier 5021429927 Add comments 2015-10-12 17:23:47 -07:00
Ari Lazier c81ea6e5be pr fixes 2015-10-12 17:18:49 -07:00
Ari Lazier 8ad1b0907d minimal tests for migrations 2015-10-12 17:01:51 -07:00
Scott Kyle c2e51ab541 Check for NaN inside RJSValidatedValueToNumber
Turns out this API can return NaN without an exception. Also added tests to make sure these conversions either work or throw exceptions in the appropriate places.
2015-10-12 16:50:45 -07:00
Ari Lazier aa035717a5 allow running all tests at the same path by invalidating all cached realm paths between test runs 2015-10-12 16:43:05 -07:00
Scott Kyle 35a8f9816c Out of bounds getters for Results return undefined 2015-10-12 15:35:13 -07:00
Scott Kyle 6788cd6f3d Out of bounds list item getters return undefined
Resolves #50
2015-10-12 15:25:39 -07:00
Scott Kyle ae9ae4dc77 Add list item setters in JS
Added a test and made other array tests syntactically consistent. Resolves #45
2015-10-12 15:25:39 -07:00
Scott Kyle 515ece8fdd Remove duplicated test in ArrayTests.js
This must have been accidentally copy-pasted from ObjectTests.js
2015-10-12 15:25:38 -07:00
Scott Kyle cc294e0353 Move object property setter assert downward 2015-10-12 12:59:40 -07:00
Scott Kyle c600af9182 Mutating lists outside transaction should throw 2015-10-12 02:23:09 -07:00
Scott Kyle 33e0f5d8b1 Setting properties outside transaction should throw
Resolves #40
2015-10-12 02:02:23 -07:00