Commit Graph

86 Commits

Author SHA1 Message Date
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
Scott Kyle 37d5a12094 Add test for calling create() outside transaction 2015-10-12 02:01:29 -07:00
Scott Kyle 48c9336526 Tabs -> Spaces in ObjectTests.js 2015-10-12 01:59:34 -07:00
Scott Kyle 88352721f7 Make all tests explicitly require realm module 2015-10-08 16:19:19 -07:00
Scott Kyle 3f3710339f Update ReactTests to re-install local NPM modules 2015-10-08 16:02:54 -07:00