Skip to content

Proxy to masterPod instance if no DNS mapping#96

Merged
Myztiq merged 13 commits intomasterfrom
SAN-3023-referer-route-to-master-with-no-dns-mapping
Dec 3, 2015
Merged

Proxy to masterPod instance if no DNS mapping#96
Myztiq merged 13 commits intomasterfrom
SAN-3023-referer-route-to-master-with-no-dns-mapping

Conversation

@cflynn07
Copy link
Copy Markdown
Contributor

…ute-to-master-with-no-dns-mapping

* origin/master:
  3.1.3
  Fixed bad bug where the replace of {{DOMAIN}} was not being ran because the script wasn't replacing it's contents properly.
  Update log msg fields to reflect new module method org
  Change test to complete when function calls back

Conflicts:
	lib/models/api.js
Comment thread test/unit/api.js Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this function doesn't need to exist.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That method is invoked by the code under test and for the test to be successful it needs to return undefined. What do you mean by function doesn't need to exist -- the function doesn't need to be stubbed? Not stubbed in this way?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you could do sinon.stub(mongo.constructor, 'findAssociationShortHashByElasticUrl') and that'd be the same of what you just did.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

well to be clear

sinon.stub(mongo.constructor, 'findAssociationShortHashByElasticUrl').returns(undefined)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is .returns(undefined) needed? Isn't that implicit? I'm not against being explicit here, but we should get some standard for how we approach that case so we are consistent.

@anandkumarpatel
Copy link
Copy Markdown
Contributor

reviewed: have minor nits but code looks good. will check the box in the description when satisfied

Comment thread test/unit/api.js Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can be done with sinon.stub(mongo.constructor, 'findMasterPodBranch).returns(mockNaviEntry)

@anandkumarpatel
Copy link
Copy Markdown
Contributor

so the main reason I would like the test changes is not because the way you are doing it is wrong (it does meet the requirements and works) however there are patterns which most of the other repos follow. they are not documented which is why its hard to follow (ill try to write something quick up) but we should try and keep our testing patterns consistent across all repos so anyone can easily jump in and follow some standard runnable conventions to write test, unit/funtional/integration test

@cflynn07
Copy link
Copy Markdown
Contributor Author

cflynn07 commented Dec 1, 2015

@anandkumarpatel I agree with the patterns you've explained so I tried to move a substantial number of the stubs & assertions over to using the preferred sinon APIs. I'll make use of those discussed patterns and sinon APIs in all future testing.

Comment thread test/unit/api.js
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No reason to do the if here. Since the beforeEach will always stub it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is here because some of the methods under test assumed it wasn't stubbed... so some of the tests might have restored it themselves before the afterEach. Not ideal, I know.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants