Skip to content

Add tests to proxy#5

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

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

Conversation

@dror007

@dror007 dror007 commented Aug 8, 2016

Copy link
Copy Markdown

No description provided.

Comment thread proxy.js
}

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

@cowchimp cowchimp Oct 18, 2016

Copy link
Copy Markdown
Collaborator

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

Comment thread test/mocha/proxy.js
var query = "dummy-query";
var token = "dummy-token";

it("WhenResponseReturnWithError_ShouldCallCallbackWithError", sinon.test(function() {

Copy link
Copy Markdown
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

Comment thread test/mocha/proxy.js
var dummyErrorMessage = "dummy-error-message";
var expectedError = new Error("Error while trying to call platform endpoint " + endpoint + " : " + dummyErrorMessage);

SetResponseWithError(this, dummyErrorMessage);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

camelCase

Comment thread test/mocha/proxy.js
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
Copy Markdown
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

Comment thread package.json
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "./node_modules/.bin/mocha test/mocha"

Copy link
Copy Markdown
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

@cowchimp cowchimp left a comment

Copy link
Copy Markdown
Collaborator

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