usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [22/51] [abbrv] git commit: tests for UsergridError
Date Thu, 13 Feb 2014 14:21:06 GMT
tests for UsergridError


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

Branch: refs/heads/two-dot-o
Commit: a976d1a7781e46ab76ea9db2852fb45795dbb0c6
Parents: 650cfd5
Author: ryan bridges <rbridges@apigee.com>
Authored: Mon Feb 10 16:46:43 2014 -0500
Committer: ryan bridges <rbridges@apigee.com>
Committed: Mon Feb 10 16:46:43 2014 -0500

----------------------------------------------------------------------
 sdks/html5-javascript/tests/mocha/test.js | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a976d1a7/sdks/html5-javascript/tests/mocha/test.js
----------------------------------------------------------------------
diff --git a/sdks/html5-javascript/tests/mocha/test.js b/sdks/html5-javascript/tests/mocha/test.js
index f3cb9e4..350706c 100644
--- a/sdks/html5-javascript/tests/mocha/test.js
+++ b/sdks/html5-javascript/tests/mocha/test.js
@@ -58,6 +58,24 @@ describe('Ajax', function() {
         })
     })
 });
+describe('UsergridError', function() {
+    var errorResponse={
+        "error":"service_resource_not_found",
+        "timestamp":1392067967144,
+        "duration":0,
+        "exception":"org.usergrid.services.exceptions.ServiceResourceNotFoundException",
+        "error_description":"Service resource not found"
+    };
+    it('should unmarshal a response from Usergrid into a proper Javascript error',function(done){
+        var error = UsergridError.fromResponse(errorResponse);
+        console.log(error, errorResponse);
+        assert(error.name===errorResponse.error, "Error name not set correctly");
+        console.log(error.name,errorResponse.error);
+        assert(error.message===errorResponse.error_description, "Error message not set correctly");
+        console.log(error.message,errorResponse.error_description);
+        done();
+    });
+});
 describe('Usergrid Request/Response', function() {
     var dogName="dog"+Math.floor(Math.random()*10000);
     var dogData=JSON.stringify({type:"dog",name:dogName});


Mime
View raw message