Updates. See commit details.

Mocha tests command now uses 2.1 config by default instead of failing.
Added 1.0 config which is tested and works.
Edited some tests to fix running with 1.0 config.


Project: http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/commit/b851dbaf
Tree: http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/tree/b851dbaf
Diff: http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/diff/b851dbaf

Branch: refs/heads/master
Commit: b851dbaf1bd160349120e8d37831c0576e32248e
Parents: 3042dfd
Author: Robert Walsh <[email protected]>
Authored: Wed Nov 9 15:21:17 2016 -0600
Committer: Robert Walsh <[email protected]>
Committed: Wed Nov 9 15:21:17 2016 -0600

----------------------------------------------------------------------
 helpers/config.js               |  2 +-
 tests/config.test.json          | 13 +++++++++++++
 tests/lib/client.rest.test.js   |  4 ++--
 tests/lib/response.test.js      |  4 ++--
 tests/lib/usergrid.init.test.js |  2 +-
 5 files changed, 19 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/blob/b851dbaf/helpers/config.js
----------------------------------------------------------------------
diff --git a/helpers/config.js b/helpers/config.js
index 50af670..860d9e2 100644
--- a/helpers/config.js
+++ b/helpers/config.js
@@ -21,7 +21,7 @@ var util = require('util'),
     appRoot = path.dirname(require.main.filename)
 
 if (/mocha$/i.test(process.argv[1])) {
-    var target = _(_.last(process.argv)).startsWith('--target=') ? 
_.last(process.argv).replace(/--target=/, '') : '1.0'
+    var target = (_.last(process.argv)).startsWith('--target=') ? 
_.last(process.argv).replace(/--target=/, '') : '2.1'
     var config = require('../tests/config.test.json')[target]
     if (config && target) {
         config.target = target

http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/blob/b851dbaf/tests/config.test.json
----------------------------------------------------------------------
diff --git a/tests/config.test.json b/tests/config.test.json
index 9ab0b61..654298e 100644
--- a/tests/config.test.json
+++ b/tests/config.test.json
@@ -1,4 +1,17 @@
 {
+    "1.0": {
+        "orgId": "rwalsh",
+        "appId": "nodejs",
+        "baseUrl": "https://api.usergrid.com";,
+        "clientId": "YXA68wzo4KbAEea4p6tiytxmag",
+        "clientSecret": "YXA671McJDKY_C3oU1HpdbJBqGMf_Y0",
+        "test": {
+            "collection": "nodejs",
+            "email": "[email protected]",
+            "password": "P@ssw0rd",
+            "username": "authtest"
+        }
+    },
     "2.1": {
         "appId": "sdksandbox",
         "baseUrl": "https://api-connectors-prod.apigee.net/appservices";,

http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/blob/b851dbaf/tests/lib/client.rest.test.js
----------------------------------------------------------------------
diff --git a/tests/lib/client.rest.test.js b/tests/lib/client.rest.test.js
index 2956122..61d796b 100644
--- a/tests/lib/client.rest.test.js
+++ b/tests/lib/client.rest.test.js
@@ -390,7 +390,7 @@ describe('DELETE()', function() {
     })
 
     it('response.error.name should equal "entity_not_found"', function() {
-        response.error.name.should.equal('entity_not_found')
+        response.error.name.should.equal((config.target === '1.0') ? 
'service_resource_not_found' : 'entity_not_found')
     })
 
     it('should support deleting an entity by passing a UsergridEntity object', 
function(done) {
@@ -407,7 +407,7 @@ describe('DELETE()', function() {
             client.DELETE(usergridResponse.entity, function() {
                 client.GET(config.test.collection, 
usergridResponse.entity.uuid, function(err, delResponse) {
                     delResponse.ok.should.be.false()
-                    delResponse.error.name.should.equal('entity_not_found')
+                    delResponse.error.name.should.equal((config.target === 
'1.0') ? 'service_resource_not_found' : 'entity_not_found')
                     done()
                 })
             })

http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/blob/b851dbaf/tests/lib/response.test.js
----------------------------------------------------------------------
diff --git a/tests/lib/response.test.js b/tests/lib/response.test.js
index f507559..5341e5e 100644
--- a/tests/lib/response.test.js
+++ b/tests/lib/response.test.js
@@ -170,7 +170,7 @@ describe('loadNextPage()', function() {
         this.slow(_slow)
         this.timeout(_timeout)
 
-        var query = new UsergridQuery(config.test.collection).limit(2)
+        var query = new UsergridQuery(config.test.collection).limit(10)
 
         client.GET(query, function(err, usergridResponse) {
             firstResponse = usergridResponse
@@ -181,7 +181,7 @@ describe('loadNextPage()', function() {
     it('should load a new page of entities by passing an instance of 
UsergridClient', function(done) {
         firstResponse.loadNextPage(client, function(err, usergridResponse) {
             
usergridResponse.first.uuid.should.not.equal(firstResponse.first.uuid)
-            usergridResponse.entities.length.should.equal(2)
+            usergridResponse.entities.length.should.equal(10)
             done()
         })
     })

http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/blob/b851dbaf/tests/lib/usergrid.init.test.js
----------------------------------------------------------------------
diff --git a/tests/lib/usergrid.init.test.js b/tests/lib/usergrid.init.test.js
index 3c1a8fb..b8b29c2 100644
--- a/tests/lib/usergrid.init.test.js
+++ b/tests/lib/usergrid.init.test.js
@@ -16,7 +16,7 @@ describe('init() / initSharedInstance()', function() {
     })
     
     it(util.format('should be testing against a Usergrid v%s instance', 
config.target), function(done) {
-        util.format('--target=%s', 
config.target).should.equal(_.last(process.argv))
+        util.format('%s', 
config.target).should.equal((_.last(process.argv)).startsWith('--target=') ? 
_.last(process.argv).replace(/--target=/, '') : '2.1')
         done()
     })
 })
\ No newline at end of file

Reply via email to