Skip to content

Add tests to proxy#5

Open
dror007 wants to merge 3 commits intoSYW:masterfrom
dror007:add-tests
Open

Add tests to proxy#5
dror007 wants to merge 3 commits intoSYW:masterfrom
dror007:add-tests

Conversation

@dror007
Copy link

@dror007 dror007 commented Aug 8, 2016

No description provided.

}

function createError(errMsg) {
callback(new Error('Error while trying to call platform endpoint ' + endpoint + errMsg));
Copy link
Collaborator

@cowchimp cowchimp Oct 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need another space i think

var query = "dummy-query";
var token = "dummy-token";

it("WhenResponseReturnWithError_ShouldCallCallbackWithError", sinon.test(function() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use spaces- more readable

var dummyErrorMessage = "dummy-error-message";
var expectedError = new Error("Error while trying to call platform endpoint " + endpoint + " : " + dummyErrorMessage);

SetResponseWithError(this, dummyErrorMessage);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

camelCase

proxy.callEndpoint(appId, appSecret, endpoint, query, token, callback);

sinon.assert.calledOnce(callback);
sinon.assert.calledWith(callback, sinon.match.same(null), sinon.match(expectedBody));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to make it clearer that sinon.match.same(null) mean that errback was not called, consider putting it in a variable with a meaningful name

"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "./node_modules/.bin/mocha test/mocha"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"test": "mocha test" should work.
might need to remove the mocha subfolder

Copy link
Collaborator

@cowchimp cowchimp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants