Merge branch 'al-android-aar' of https://github.com/realm/realm-js into al-android-aar
This commit is contained in:
commit
3067ed8bc1
|
@ -36,6 +36,9 @@ public class RealmReactAndroid extends ReactContextBaseJavaModule {
|
|||
final Map<String, Object> constants = new HashMap<>();
|
||||
constants.put(DURATION_SHORT_KEY, Toast.LENGTH_SHORT);
|
||||
constants.put(DURATION_LONG_KEY, Toast.LENGTH_LONG);
|
||||
|
||||
Log.w("RealmReactAndroid", injectRealmJsContext());
|
||||
|
||||
return constants;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace realm {
|
|||
|
||||
std::string default_realm_file_directory()
|
||||
{
|
||||
return std::string("");
|
||||
return std::string("/data/data/com.demo/files/");
|
||||
}
|
||||
|
||||
void ensure_directory_exists_for_file(const std::string &fileName)
|
||||
|
|
|
@ -163,13 +163,15 @@ module.exports = BaseTest.extend({
|
|||
realm.write(function() {
|
||||
obj = realm.create('NullableBasicTypesObject', basicTypesValues);
|
||||
obj1 = realm.create('NullableBasicTypesObject', basicTypesValues);
|
||||
for (var prop of schemas.NullableBasicTypes.properties) {
|
||||
for (var index in schemas.NullableBasicTypes.properties) {
|
||||
var prop = schemas.NullableBasicTypes.properties[index];
|
||||
obj[prop.name] = null;
|
||||
obj1[prop.name] = undefined;
|
||||
}
|
||||
});
|
||||
|
||||
for (var prop of schemas.NullableBasicTypes.properties) {
|
||||
for (var index in schemas.NullableBasicTypes.properties) {
|
||||
var prop = schemas.NullableBasicTypes.properties[index];
|
||||
TestCase.assertEqual(obj[prop.name], null);
|
||||
TestCase.assertEqual(obj1[prop.name], null);
|
||||
}
|
||||
|
|
|
@ -17,13 +17,48 @@ var RealmReactAndroid = require('NativeModules').RealmReactAndroid;
|
|||
var Realm = require('realm');
|
||||
var RealmTests = require('realm-tests');
|
||||
|
||||
function runTests() {
|
||||
RealmTests.ObjectTests.testNullableBasicTypesPropertySetters();
|
||||
let testNames = RealmTests.getTestNames();
|
||||
|
||||
for (let suiteName in testNames) {
|
||||
let testSuite = RealmTests[suiteName];
|
||||
|
||||
console.log('Starting ' + suiteName);
|
||||
|
||||
var suiteTestNames = testNames[suiteName];
|
||||
for (var index in suiteTestNames) {
|
||||
var testName = suiteTestNames[index];
|
||||
console.log('Starting ' + testName);
|
||||
|
||||
if (testSuite.beforeEach) {
|
||||
testSuite.beforeEach();
|
||||
}
|
||||
|
||||
try {
|
||||
testSuite[testName]();
|
||||
console.log('+ ' + testName);
|
||||
}
|
||||
catch (e) {
|
||||
console.log('- ' + testName);
|
||||
console.warn(e.message);
|
||||
}
|
||||
finally {
|
||||
if (testSuite.afterEach) {
|
||||
testSuite.afterEach();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var Demo = React.createClass({
|
||||
render: function() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Text style={styles.welcome}>
|
||||
Trying to inject Realm JS Context
|
||||
</Text>
|
||||
<Text style={styles.button} onPress={runTests}>
|
||||
Tap to Run Tests
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"start": "react-native start"
|
||||
},
|
||||
"dependencies": {
|
||||
"react-native": "^0.16.0",
|
||||
"react-native": "^0.18.0-rc",
|
||||
"realm": "file:../../lib",
|
||||
"realm-tests": "file:../lib"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue