From 2c8696ea571fadeb3cc932bd4ae39b5be6c6fef8 Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Mon, 11 Jan 2016 19:20:33 -0800 Subject: [PATCH 1/4] initialize in the right placE --- .../app/src/main/java/com/reacttests/RealmReactAndroid.java | 3 ++- tests/react-test-app/index.android.js | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/react-native/android/app/src/main/java/com/reacttests/RealmReactAndroid.java b/react-native/android/app/src/main/java/com/reacttests/RealmReactAndroid.java index 87862d60..a9ed3289 100644 --- a/react-native/android/app/src/main/java/com/reacttests/RealmReactAndroid.java +++ b/react-native/android/app/src/main/java/com/reacttests/RealmReactAndroid.java @@ -29,8 +29,9 @@ public class RealmReactAndroid extends ReactContextBaseJavaModule { } @Override - public void initialize() { + public Map getConstants() { Log.w("RealmReactAndroid", injectRealmJsContext(filesDirPath)); + return new HashMap<>(); } @Override diff --git a/tests/react-test-app/index.android.js b/tests/react-test-app/index.android.js index 6b10a650..f1ec3c14 100644 --- a/tests/react-test-app/index.android.js +++ b/tests/react-test-app/index.android.js @@ -18,7 +18,6 @@ var Realm = require('realm'); var RealmTests = require('realm-tests'); function runTests() { - RealmTests.ObjectTests.testNullableBasicTypesPropertySetters(); let testNames = RealmTests.getTestNames(); for (let suiteName in testNames) { From 469121429ac23fa4ab647a6f9ac1930daa52ec5a Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Mon, 11 Jan 2016 19:27:00 -0800 Subject: [PATCH 2/4] implementation for remove files --- src/android/platform.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/android/platform.cpp b/src/android/platform.cpp index 5da8d301..54d5ef1b 100644 --- a/src/android/platform.cpp +++ b/src/android/platform.cpp @@ -5,6 +5,7 @@ #include "../platform.hpp" #include "../js_init.h" #include +#include std::string s_default_realm_directory; @@ -21,6 +22,9 @@ std::string default_realm_file_directory() void ensure_directory_exists_for_file(const std::string &fileName) { + std::string cmd = "rm " + s_default_realm_directory + "/*.realm " + + s_default_realm_directory + "/*.realm.lock"; + system(cmd.c_str()); } void remove_realm_files_from_directory(const std::string &directory) From 1c5f22bd4d2a631fdd7a2ac519cb63b4f2e51163 Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Mon, 11 Jan 2016 19:32:46 -0800 Subject: [PATCH 3/4] fix for query tests --- tests/lib/QueryTests.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/lib/QueryTests.js b/tests/lib/QueryTests.js index 137cf9a4..55eaa17e 100644 --- a/tests/lib/QueryTests.js +++ b/tests/lib/QueryTests.js @@ -62,7 +62,8 @@ function runQuerySuite(suite) { return args; } - for (var test of suite.tests) { + for (var index in suite.tests) { + var test = suite.tests[index]; if (test[0] == "QueryCount") { var length = realm.objects.apply(realm, getArgs(2)).length; TestCase.assertEqual(test[1], length, "Query '" + args[1] + "' on type '" + args[0] + "' expected " + test[1] + " results, got " + length); From 211f0eddd50aa1f1c7aae1f804cdfc0c507b97bd Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Mon, 11 Jan 2016 19:42:20 -0800 Subject: [PATCH 4/4] improve exception message --- tests/lib/RealmTests.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/lib/RealmTests.js b/tests/lib/RealmTests.js index 32bb20b7..a404c9e9 100644 --- a/tests/lib/RealmTests.js +++ b/tests/lib/RealmTests.js @@ -69,9 +69,8 @@ module.exports = BaseTest.extend({ var newPath = util.realmPathForFile('default2.realm'); Realm.defaultPath = newPath; defaultRealm = new Realm({schema: []}); - TestCase.assertEqual(defaultRealm.path, newPath); - TestCase.assertEqual(Realm.defaultPath, newPath); - + TestCase.assertEqual(defaultRealm.path, newPath, "should use updated default realm path"); + TestCase.assertEqual(Realm.defaultPath, newPath, "defaultPath should have been updated"); }, testRealmCreate: function() {