From 08fada74d644a41dc2f038027d5357ad39c2d186 Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Fri, 2 Oct 2015 15:15:25 -0700 Subject: [PATCH] fix so that RealmJS tests work again --- tests/ArrayTests.js | 6 ------ tests/ObjectTests.js | 7 ------- tests/RealmJSTests.mm | 2 ++ tests/RealmTests.js | 10 ---------- tests/ResultsTests.js | 6 ------ tests/index.js | 10 ++++++++++ 6 files changed, 12 insertions(+), 29 deletions(-) diff --git a/tests/ArrayTests.js b/tests/ArrayTests.js index 77728533..16729fbe 100644 --- a/tests/ArrayTests.js +++ b/tests/ArrayTests.js @@ -18,12 +18,6 @@ 'use strict'; -var TestCase = require('./TestCase'); -var { - LinkTypesObjectSchema, - TestObjectSchema, -} = require('./TestObjects'); - var ArrayTests = { testLinkTypesPropertySetters: function() { var realm = new Realm({schema: [LinkTypesObjectSchema, TestObjectSchema]}); diff --git a/tests/ObjectTests.js b/tests/ObjectTests.js index d898f076..f5dbe48d 100644 --- a/tests/ObjectTests.js +++ b/tests/ObjectTests.js @@ -18,13 +18,6 @@ 'use strict'; -var TestCase = require('./TestCase'); -var { - LinkTypesObjectSchema, - TestObjectSchema, - BasicTypesObjectSchema, -} = require('./TestObjects'); - var ObjectTests = { testBasicTypesPropertyGetters: function() { var basicTypesValues = [true, 1, 1.1, 1.11, 'string', new Date(1), 'DATA']; diff --git a/tests/RealmJSTests.mm b/tests/RealmJSTests.mm index bd7445bc..71bde080 100644 --- a/tests/RealmJSTests.mm +++ b/tests/RealmJSTests.mm @@ -82,6 +82,7 @@ static JSClassRef s_globalClass; [RealmJS initializeContext:ctx]; + [self evaluateScript:@"var exports = {};" fromURL:nil]; [self evaluateScriptWithName:@"TestCase"]; [self evaluateScriptWithName:@"TestObjects"]; [self evaluateScriptWithName:self.class.jsSuiteName]; @@ -183,6 +184,7 @@ static JSClassRef s_globalClass; JSContext *context = [[JSContext alloc] init]; JSValue *exception; + [self evaluateScript:@"var exports = {};" fromURL:nil inContext:context exception:&exception]; [self evaluateScript:script fromURL:scriptURL inContext:context exception:&exception]; if (exception) { NSLog(@"%@.js - %@", suiteName, exception); diff --git a/tests/RealmTests.js b/tests/RealmTests.js index d173620f..bb69cca4 100644 --- a/tests/RealmTests.js +++ b/tests/RealmTests.js @@ -18,16 +18,6 @@ 'use strict'; -var TestCase = require('./TestCase'); -var { - LinkTypesObjectSchema, - TestObjectSchema, - IntPrimaryObjectSchema, - AllTypesObjectSchema, - DefaultValuesObjectSchema, - PersonObject, -} = require('./TestObjects'); - var RealmTests = { testRealmConstructorPath: function() { TestCase.assertThrows(function() { new Realm('/invalidpath'); }); diff --git a/tests/ResultsTests.js b/tests/ResultsTests.js index 9da420fa..e85173fd 100644 --- a/tests/ResultsTests.js +++ b/tests/ResultsTests.js @@ -18,12 +18,6 @@ 'use strict'; -var TestCase = require('./TestCase'); -var { - LinkTypesObjectSchema, - TestObjectSchema, -} = require('./TestObjects'); - var ResultsTests = { testResultsLength: function() { var realm = new Realm({schema: [TestObjectSchema]}); diff --git a/tests/index.js b/tests/index.js index e2150f13..ebe95760 100644 --- a/tests/index.js +++ b/tests/index.js @@ -1,5 +1,15 @@ 'use strict'; +var TestCase = require('./TestCase'); +var { + LinkTypesObjectSchema, + TestObjectSchema, + IntPrimaryObjectSchema, + AllTypesObjectSchema, + DefaultValuesObjectSchema, + PersonObject, +} = require('./TestObjects'); + var RealmTestSuite = { tests: [ require('./ArrayTests.js'),