Skip to content

Conversation

@srinia6
Copy link
Contributor

@srinia6 srinia6 commented Feb 17, 2016

@dalebremner @brianparry @geoff-reid @abildw @RackHD/corecommitters

@dalebremner
Copy link
Contributor

👍

@jlongever
Copy link
Contributor

Interesting, no coveralls coverage check?

@srinia6
Copy link
Contributor Author

srinia6 commented Feb 17, 2016

@jlongever Does it need to be turned on ? If so, how?
FYI - this is addition to this PR - #133

@jlongever
Copy link
Contributor

@srinia6 it should be on by default. not sure why it didn't run.

@@ -0,0 +1,330 @@
// Copyright 2015, EMC, Inc.

Choose a reason for hiding this comment

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

update to 2016

@BillyAbildgaard
Copy link

I just had a minor comment about the date, but other than that it looks good to me

👍

destroyByIdentifier: sinon.stub().resolves()
};

taskProtocol = helper.injector.get("Protocol.Task");
Copy link
Contributor

Choose a reason for hiding this comment

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

indent error

@yyscamper
Copy link
Contributor

👎 for this, since I see a lot bad test case design. @srinia6 please help fix this


describe("patchPollersById", function() {
it('should expose the appropriate methods', function() {
pollerService.should.have.property('patchPollersById')

Choose a reason for hiding this comment

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

Mixed double and single quotes.
Too many errors. (53% scanned).

});

it("should return error if specific poller info is not found", function () {
var mockPoller = {"message":"NotFoundError: Could not find workitem with identifier"};
Copy link
Contributor

Choose a reason for hiding this comment

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

@srinia6 I think we want to make this an error object: var mockPollerError = new Errors.NotFoundError('Could not find workitem with identifier').

it("should return error if specific poller info is not found", function () {
var mockPollerError = new Errors.NotFoundError("Could not find workitem with identifier");
waterline.workitems.needByIdentifier.rejects(mockPollerError);
return pollerService.getPollersById().should.eventually.be.rejectedWith(mockPollerError);

Choose a reason for hiding this comment

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

Line is too long.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ignoring this error.

@jlongever
Copy link
Contributor

LGTM +1

@yyscamper
Copy link
Contributor

👍 after fix the hounci warning "Line is too long"

@brianparry
Copy link
Contributor

👍

@anhou
Copy link
Member

anhou commented Feb 24, 2016

@srinia6 all houndci's review comments should be fixed. if it could be ignored, please comment it.

👍 after fix all houndci issues

}];
waterline.workitems.needByIdentifier.withArgs({"id": "4532"}).resolves(mockPoller[0]);
waterline.workitems.needByIdentifier.withArgs({"id": "1234"}).resolves(mockPoller[1]);
Promise.all(["4532", "1234"].map(function(id, index) {
Copy link
Contributor

Choose a reason for hiding this comment

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

just realized this promise has not been returned, this should be fixed before merge.

@yyscamper
Copy link
Contributor

I have to withdraw my approval, because I still see a critical error:
(1) The Promise.all need be returned.
(2) The houndci warning about index and semicolon need be fixed, because it reflects a critical error that the brackets don't match. (I wonder why the travis ci pass the test).

Meanwhile, the hounci warning about "Line is too long" should also be fixed.

});

it("should return error if specific poller info is not found", function () {
var mockPollerError = new Errors.NotFoundError("Could not find workitem with identifier");

Choose a reason for hiding this comment

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

Line is too long.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ignoring this error.

@JenkinsRHD
Copy link
Contributor

*** BUILD #467 ***

@srinia6
Copy link
Contributor Author

srinia6 commented Feb 24, 2016

test this please

@yyscamper
Copy link
Contributor

@srinia6, Ithink you miss another fix: the promise.map need be returned otherwise your assertion logic will not take effect.

Meanwhile, for "Line is too long", if you do have reason to ignore it, you'd use jshint ignore synatx(please search jshint manual) and append it after the line you want to ingore.

@srinia6
Copy link
Contributor Author

srinia6 commented Feb 25, 2016

@yyscamper I looked at the test case. It is working as expected. The reason it was passing previously was the data [resolved] came back as undefined, and the index also was un-defined [so, the test case passed] .
This was fixed by replacing ["id" : "1234" ] with ["1234"]. Also, the brackets were closed appropriately. [from the beginning ]@brianparry the build passed.

@yyscamper
Copy link
Contributor

@srinia6 : understand the brackets design, your current code is OK for me.
My primary concern is that the promise in the test case doesn't be returned. You can do an experiment if not return the Promise. Just change the "expect(xxx).to.equal(xxx)" to the inverted logic "expect(xxx).to.not.equal(xxx)", you will find both pass!!

This is not a style problem, this is a problem about library/framework usage, so this need be fixed. If you add your assertion logic in the Promise, that promise must be returned, otherwise mocha will not wait the test case is actually done. I see all your code's Promises are returned except this one. Please refer to the mocha guideline about Promise: https://mochajs.org/#working-with-promises.

@yyscamper
Copy link
Contributor

👍 after fix the problem that Promise doesn't been returned

@srinia6
Copy link
Contributor Author

srinia6 commented Feb 25, 2016

@yyscamper : Not sure if I understood your concern. You suggested these changes!

I did try substituting per your suggestion/concern i.e.- "** Just change the "expect(xxx).to.equal(xxx)" to the inverted logic "expect(xxx).to.not.equal(xxx)", you will find both pass!! **"

I see "crisp" error showing-up as below:

Unhandled rejection AssertionError: expected { Object (id, name, ...) } to not equal { Object (id, name, ...) }
at .........
at arrayEach (.....)
at Function. (.....)
at .........
at tryCatcher (.......)
at Promise._settlePromiseFromHandler (.....)
at Promise._settlePromiseAt (.....)
at Promise._settlePromises (....)
at Async._drainQueue (......)
at Async._drainQueues (....)
at Async.drainQueues (,,,,)
at process._tickDomainCallback (node.js:459:13)

SO i am guessing it IS doing all the "right" thing?

@srinia6
Copy link
Contributor Author

srinia6 commented Feb 25, 2016

@yyscamper Fixed it. Turns out that i am not seeing the failing case because the promise is mocked-out (here).

@yyscamper
Copy link
Contributor

good 👍 . @srinia6

@srinia6
Copy link
Contributor Author

srinia6 commented Feb 25, 2016

@RackHD/corecommitters - Can you review/merge this please?

@jlongever
Copy link
Contributor

+1

jlongever added a commit that referenced this pull request Feb 25, 2016
@jlongever jlongever merged commit b0e2550 into RackHD:master Feb 25, 2016
@srinia6 srinia6 deleted the feature/swagger-pollers-route branch March 28, 2016 15:27
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.

9 participants