Permalink
Browse files

split out tests into their own files, add more assertions to them, ed…

…it makefile to call each test individually
  • Loading branch information...
1 parent 6bb1de0 commit 84c04ed97054c7f1a69b4e266e7b8853f975b70e @phated committed Mar 21, 2012
View
@@ -1,4 +1,13 @@
test:
- ./node_modules/mocha/bin/mocha
+ ./node_modules/mocha/bin/mocha ./test/gapi.coffee
+ ./node_modules/mocha/bin/mocha ./test/plus.v1.coffee
+ ./node_modules/mocha/bin/mocha ./test/plus/activities/get.coffee
+ ./node_modules/mocha/bin/mocha ./test/plus/activities/list.coffee
+ ./node_modules/mocha/bin/mocha ./test/plus/activities/search.coffee
+ ./node_modules/mocha/bin/mocha ./test/plus/comments/get.coffee
+ ./node_modules/mocha/bin/mocha ./test/plus/comments/list.coffee
+ ./node_modules/mocha/bin/mocha ./test/plus/people/get.coffee
+ ./node_modules/mocha/bin/mocha ./test/plus/people/listByActivity.coffee
+ ./node_modules/mocha/bin/mocha ./test/plus/people/search.coffee
.PHONY: test
View
@@ -15,6 +15,6 @@ module.exports =
req.end()
req.on 'error', (err) ->
- callback err
+ callback err
return req
@@ -14,4 +14,4 @@ module.exports = ({activityId, maxResults, pageToken, sortOrder, fields}) ->
config.requestOptions.path = "/plus/v1/activities/#{activityId}/comments?#{qs}"
- return '../../execute'
+ return require '../../execute'
@@ -1,17 +0,0 @@
-gapi = require "../index"
-config = require "../lib/config"
-
-gapi.server.setApiKey "AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI"
-gapi.server.load "plus", "v1", ->
- describe "calling activities.get({activityId: 'z12mijziozu0x5hrd04cfhnw1yymsn2o414'})", ->
- it "should add /plus/v1/activities/z12mijziozu0x5hrd04cfhnw1yymsn2o414?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json to config.requestOptions.path", ->
- gapi.server.plus.activities.get activityId: "z12mijziozu0x5hrd04cfhnw1yymsn2o414"
- config.requestOptions.path.should.equal "/plus/v1/activities/z12mijziozu0x5hrd04cfhnw1yymsn2o414?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json"
- describe "calling activities.list({userId: '102147307918874735077', collection: 'public', maxResults: '1'})", ->
- it "should add /plus/v1/people/102147307918874735077/activities/public?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json&maxResults=1 to config.requestOptions.path", ->
- gapi.server.plus.activities.list userId: '102147307918874735077', collection: 'public', maxResults: '1'
- config.requestOptions.path.should.equal "/plus/v1/people/102147307918874735077/activities/public?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json&maxResults=1"
- describe "calling activities.search({query: 'Test'})", ->
- it "should add /plus/v1/activities?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json&query=Test to config.requestOptions.path", ->
- gapi.server.plus.activities.search query: 'Test'
- config.requestOptions.path.should.equal "/plus/v1/activities?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json&query=Test"
View
@@ -13,4 +13,4 @@ describe "calling load with 'plus' and 'v1'", ->
it "should contain comments", ->
gapi.server.plus.should.have.property "comments"
it "should contain people", ->
- gapi.server.plus.should.have.property "people"
+ gapi.server.plus.should.have.property "people"
@@ -1,13 +0,0 @@
-gapi = require "../index"
-config = require "../lib/config"
-
-gapi.server.setApiKey "AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI"
-gapi.server.load "plus", "v1", ->
- describe "calling comments.get({commentId: 'sTcuoWTR52tnNY9UpoW2TfNb0PnCiiutGuDoTzFyeoI7hNeoa-HBWHoDTQBA59pNvtVbsipeS_U'})", ->
- it "should add /plus/v1/comments/sTcuoWTR52tnNY9UpoW2TfNb0PnCiiutGuDoTzFyeoI7hNeoa-HBWHoDTQBA59pNvtVbsipeS_U?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json to config.requestOptions.path", ->
- gapi.server.plus.comments.get commentId: 'sTcuoWTR52tnNY9UpoW2TfNb0PnCiiutGuDoTzFyeoI7hNeoa-HBWHoDTQBA59pNvtVbsipeS_U'
- config.requestOptions.path.should.equal "/plus/v1/comments/sTcuoWTR52tnNY9UpoW2TfNb0PnCiiutGuDoTzFyeoI7hNeoa-HBWHoDTQBA59pNvtVbsipeS_U?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json"
- describe "calling comments.list({activityId: 'z12mijziozu0x5hrd04cfhnw1yymsn2o414', maxResults: '1'})", ->
- it "should add /plus/v1/activities/z12mijziozu0x5hrd04cfhnw1yymsn2o414/comments?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json&maxResults=1 to config.requestOptions.path", ->
- gapi.server.plus.comments.list activityId: 'z12mijziozu0x5hrd04cfhnw1yymsn2o414', maxResults: '1'
- config.requestOptions.path.should.equal '/plus/v1/activities/z12mijziozu0x5hrd04cfhnw1yymsn2o414/comments?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json&maxResults=1'
View
@@ -1,17 +0,0 @@
-gapi = require "../index"
-config = require "../lib/config"
-
-gapi.server.setApiKey "AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI"
-gapi.server.load "plus", "v1", ->
- describe "calling people.get({userId: '102147307918874735077'})", ->
- it "should add /plus/v1/people/102147307918874735077?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json to config.requestOptions.path", ->
- gapi.server.plus.people.get userId: '102147307918874735077'
- config.requestOptions.path.should.equal '/plus/v1/people/102147307918874735077?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json'
- describe "calling people.listByActivity({activityId: 'z12mijziozu0x5hrd04cfhnw1yymsn2o414', collection: 'plusoners', maxResults: '1'})", ->
- it "should add /plus/v1/activities/z12mijziozu0x5hrd04cfhnw1yymsn2o414/people/plusoners?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json&maxResults=1 to config.requestOptions.path", ->
- gapi.server.plus.people.listByActivity activityId: 'z12mijziozu0x5hrd04cfhnw1yymsn2o414', collection: 'plusoners', maxResults: '1'
- config.requestOptions.path.should.equal '/plus/v1/activities/z12mijziozu0x5hrd04cfhnw1yymsn2o414/people/plusoners?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json&maxResults=1'
- describe "calling people.search({query: 'Blaine Bublitz'})", ->
- it "should add /plus/v1/people?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json&query=Blaine%20Bublitz to config.requestOptions.path", ->
- gapi.server.plus.people.search query: 'Blaine Bublitz'
- config.requestOptions.path.should.equal '/plus/v1/people?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json&query=Blaine%20Bublitz'
@@ -0,0 +1,20 @@
+gapi = require "../../../index"
+config = require "../../../lib/config"
+
+gapi.server.setApiKey "AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI"
+gapi.server.load "plus", "v1", ->
+ request = gapi.server.plus.activities.get activityId: 'z12mijziozu0x5hrd04cfhnw1yymsn2o414'
+
+ describe "calling activities.get({activityId: 'z12mijziozu0x5hrd04cfhnw1yymsn2o414'})", ->
+ it "should add /plus/v1/activities/z12mijziozu0x5hrd04cfhnw1yymsn2o414?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json to config.requestOptions.path", ->
+ config.requestOptions.path.should.equal "/plus/v1/activities/z12mijziozu0x5hrd04cfhnw1yymsn2o414?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json"
+ it "should return execute function", ->
+ request.should.have.property 'execute'
+ request.execute.should.be.a 'function'
+
+ describe "calling execute with a callback", ->
+ it "should make a request and return an object to the callback", (done) ->
+ request.execute (resp) ->
+ resp.should.be.a 'object'
+ #resp.should.not.have.property 'error'
+ done()
@@ -1,17 +0,0 @@
-var gapi = require('../../../lib/gapi');
-var should = require('should');
-
-gapi.server.setApiKey('AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI');
-gapi.server.load('plus','v1',function() {
-
- // Successful request to activities.get()
- var activitiesGetRequest = gapi.server.plus.activities.get({activityId: 'z12mijziozu0x5hrd04cfhnw1yymsn2o414', maxResults: '1'});
- activitiesGetRequest.execute(function(resp){
- resp.should.have.property('object');
- });
-
- // Failed request to activities.get()
- var activitiesGetRequestFail = gapi.server.plus.activities.get();
- should.not.exist(activitiesGetRequestFail);
-
-});
@@ -0,0 +1,20 @@
+gapi = require "../../../index"
+config = require "../../../lib/config"
+
+gapi.server.setApiKey "AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI"
+gapi.server.load "plus", "v1", ->
+ request = gapi.server.plus.activities.list userId: '102147307918874735077', collection: 'public', maxResults: '1'
+
+ describe "calling activities.list({userId: '102147307918874735077', collection: 'public', maxResults: '1'})", ->
+ it "should add /plus/v1/people/102147307918874735077/activities/public?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json&maxResults=1 to config.requestOptions.path", ->
+ config.requestOptions.path.should.equal "/plus/v1/people/102147307918874735077/activities/public?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json&maxResults=1"
+ it "should return execute function", ->
+ request.should.have.property 'execute'
+ request.execute.should.be.a 'function'
+
+ describe "calling execute with a callback", ->
+ it "should make a request and return an object to the callback", (done) ->
+ request.execute (resp) ->
+ resp.should.be.a 'object'
+ #resp.should.not.have.property 'error'
+ done()
@@ -1,17 +0,0 @@
-var gapi = require('../../../lib/gapi');
-var should = require('should');
-
-gapi.server.setApiKey('AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI');
-gapi.server.load('plus','v1',function() {
-
- // Successful request to activities.list()
- var activitiesListRequest = gapi.server.plus.activities.list({userId: '102147307918874735077', collection: 'public', maxResults: '1'});
- activitiesListRequest.execute(function(resp) {
- resp.should.have.property('items');
- });
-
- // Failed request to activities.list()
- var activitiesListRequestFail = gapi.server.plus.activities.list();
- should.not.exist(activitiesListRequestFail);
-
-});
@@ -0,0 +1,20 @@
+gapi = require "../../../index"
+config = require "../../../lib/config"
+
+gapi.server.setApiKey "AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI"
+gapi.server.load "plus", "v1", ->
+ request = gapi.server.plus.activities.search query: 'Test'
+
+ describe "calling activities.search({query: 'Test'})", ->
+ it "should add /plus/v1/activities?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json&query=Test to config.requestOptions.path", ->
+ config.requestOptions.path.should.equal "/plus/v1/activities?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json&query=Test"
+ it "should return execute function", ->
+ request.should.have.property 'execute'
+ request.execute.should.be.a 'function'
+
+ describe "calling execute with a callback", ->
+ it "should make a request and return an object to the callback", (done) ->
+ request.execute (resp) ->
+ resp.should.be.a 'object'
+ #resp.should.not.have.property 'error'
+ done()
@@ -1,17 +0,0 @@
-var gapi = require('../../../lib/gapi');
-var should = require('should');
-
-gapi.server.setApiKey('AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI');
-gapi.server.load('plus','v1',function() {
-
- // Successful request to activities.search()
- var activitiesSearchRequest = gapi.server.plus.activities.search({query: 'Test'});
- activitiesSearchRequest.execute(function(resp) {
- resp.should.have.property('items');
- });
-
- // Failed request to activities.search()
- var activitiesSearchRequestFail = gapi.server.plus.activities.search();
- should.not.exist(activitiesSearchRequestFail);
-
-});
@@ -0,0 +1,20 @@
+gapi = require "../../../index"
+config = require "../../../lib/config"
+
+gapi.server.setApiKey "AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI"
+gapi.server.load "plus", "v1", ->
+ request = gapi.server.plus.comments.get commentId: 'sTcuoWTR52tnNY9UpoW2TfNb0PnCiiutGuDoTzFyeoI7hNeoa-HBWHoDTQBA59pNvtVbsipeS_U'
+
+ describe "calling comments.get({commentId: 'sTcuoWTR52tnNY9UpoW2TfNb0PnCiiutGuDoTzFyeoI7hNeoa-HBWHoDTQBA59pNvtVbsipeS_U'})", ->
+ it "should add /plus/v1/comments/sTcuoWTR52tnNY9UpoW2TfNb0PnCiiutGuDoTzFyeoI7hNeoa-HBWHoDTQBA59pNvtVbsipeS_U?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json to config.requestOptions.path", ->
+ config.requestOptions.path.should.equal "/plus/v1/comments/sTcuoWTR52tnNY9UpoW2TfNb0PnCiiutGuDoTzFyeoI7hNeoa-HBWHoDTQBA59pNvtVbsipeS_U?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json"
+ it "should return execute function", ->
+ request.should.have.property 'execute'
+ request.execute.should.be.a 'function'
+
+ describe "calling execute with a callback", ->
+ it "should make a request and return an object to the callback", (done) ->
+ request.execute (resp) ->
+ resp.should.be.a 'object'
+ #resp.should.not.have.property 'error'
+ done()
View
@@ -1,17 +0,0 @@
-var gapi = require('../../../lib/gapi');
-var should = require('should');
-
-gapi.server.setApiKey('AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI');
-gapi.server.load('plus','v1',function() {
-
- // Successful request to comments.get()
- var commentsGetRequest = gapi.server.plus.comments.get({commentId: 'sTcuoWTR52tnNY9UpoW2TfNb0PnCiiutGuDoTzFyeoI7hNeoa-HBWHoDTQBA59pNvtVbsipeS_U', maxResults: '1'});
- commentsGetRequest.execute(function(resp) {
- resp.should.have.property('object');
- });
-
- // Failed request to comments.get()
- var commentsGetRequestFail = gapi.server.plus.comments.get();
- should.not.exist(commentsGetRequestFail);
-
-});
@@ -0,0 +1,20 @@
+gapi = require "../../../index"
+config = require "../../../lib/config"
+
+gapi.server.setApiKey "AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI"
+gapi.server.load "plus", "v1", ->
+ request = gapi.server.plus.comments.list activityId: 'z12mijziozu0x5hrd04cfhnw1yymsn2o414', maxResults: '1'
+
+ describe "calling comments.list({activityId: 'z12mijziozu0x5hrd04cfhnw1yymsn2o414', maxResults: '1'})", ->
+ it "should add /plus/v1/activities/z12mijziozu0x5hrd04cfhnw1yymsn2o414/comments?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json&maxResults=1 to config.requestOptions.path", ->
+ config.requestOptions.path.should.equal '/plus/v1/activities/z12mijziozu0x5hrd04cfhnw1yymsn2o414/comments?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json&maxResults=1'
+ it "should return execute function", ->
+ request.should.have.property 'execute'
+ request.execute.should.be.a 'function'
+
+ describe "calling execute with a callback", ->
+ it "should make a request and return an object to the callback", (done) ->
+ request.execute (resp) ->
+ resp.should.be.a 'object'
+ #resp.should.not.have.property 'error'
+ done()
View
@@ -1,17 +0,0 @@
-var gapi = require('../../../lib/gapi');
-var should = require('should');
-
-gapi.server.setApiKey('AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI');
-gapi.server.load('plus','v1',function() {
-
- // Successful request to comments.list()
- var commentsListRequest = gapi.server.plus.comments.list({activityId: 'z12mijziozu0x5hrd04cfhnw1yymsn2o414', maxResults: '1'});
- commentsListRequest.execute(function(resp) {
- resp.should.have.property('items');
- });
-
- // Failed request to comments.list()
- var commentsListRequestFail = gapi.server.plus.comments.list();
- should.not.exist(commentsListRequestFail);
-
-});
@@ -0,0 +1,20 @@
+gapi = require "../../../index"
+config = require "../../../lib/config"
+
+gapi.server.setApiKey "AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI"
+gapi.server.load "plus", "v1", ->
+ request = gapi.server.plus.people.get userId: '102147307918874735077'
+
+ describe "calling people.get({userId: '102147307918874735077'})", ->
+ it "should add /plus/v1/people/102147307918874735077?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json to config.requestOptions.path", ->
+ config.requestOptions.path.should.equal '/plus/v1/people/102147307918874735077?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json'
+ it "should return execute function", ->
+ request.should.have.property 'execute'
+ request.execute.should.be.a 'function'
+
+ describe "calling execute with a callback", ->
+ it "should make a request and return an object to the callback", (done) ->
+ request.execute (resp) ->
+ resp.should.be.a 'object'
+ #resp.should.not.have.property 'error'
+ done()
View
@@ -1,17 +0,0 @@
-var gapi = require('../../../lib/gapi');
-var should = require('should');
-
-gapi.server.setApiKey('AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI');
-gapi.server.load('plus','v1',function() {
-
- // Successful request to people.get()
- var peopleGetRequest = gapi.server.plus.people.get({userId: '102147307918874735077', maxResults: '1'});
- peopleGetRequest.execute(function(resp) {
- resp.should.have.property('displayName');
- });
-
- // Failed request to people.get()
- var peopleGetRequestFail = gapi.server.plus.people.get();
- should.not.exist(peopleGetRequestFail);
-
-});
@@ -0,0 +1,20 @@
+gapi = require "../../../index"
+config = require "../../../lib/config"
+
+gapi.server.setApiKey "AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI"
+gapi.server.load "plus", "v1", ->
+ request = gapi.server.plus.people.listByActivity activityId: 'z12mijziozu0x5hrd04cfhnw1yymsn2o414', collection: 'plusoners', maxResults: '1'
+
+ describe "calling people.listByActivity({activityId: 'z12mijziozu0x5hrd04cfhnw1yymsn2o414', collection: 'plusoners', maxResults: '1'})", ->
+ it "should add /plus/v1/activities/z12mijziozu0x5hrd04cfhnw1yymsn2o414/people/plusoners?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json&maxResults=1 to config.requestOptions.path", ->
+ config.requestOptions.path.should.equal '/plus/v1/activities/z12mijziozu0x5hrd04cfhnw1yymsn2o414/people/plusoners?key=AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI&alt=json&maxResults=1'
+ it "should return execute function", ->
+ request.should.have.property 'execute'
+ request.execute.should.be.a 'function'
+
+ describe "calling execute with a callback", ->
+ it "should make a request and return an object to the callback", (done) ->
+ request.execute (resp) ->
+ resp.should.be.a 'object'
+ #resp.should.not.have.property 'error'
+ done()
@@ -1,17 +0,0 @@
-var gapi = require('../../../lib/gapi');
-var should = require('should');
-
-gapi.server.setApiKey('AIzaSyB14Ua7k5_wusxHTQEH3sqmglO7MHjHPCI');
-gapi.server.load('plus','v1',function() {
-
- // Successful request to people.listByActivity()
- var peopleListByActivityRequest = gapi.server.plus.people.listByActivity({activityId: 'z12mijziozu0x5hrd04cfhnw1yymsn2o414', collection: 'plusoners', maxResults: '1'});
- peopleListByActivityRequest.execute(function(resp) {
- resp.should.have.property('items');
- });
-
- // Failed request to people.listByActivity()
- var peopleListByActivityRequestFail = gapi.server.plus.people.listByActivity();
- should.not.exist(peopleListByActivityRequestFail);
-
-});
Oops, something went wrong.

0 comments on commit 84c04ed

Please sign in to comment.