Skip to content
This repository has been archived by the owner on Feb 13, 2021. It is now read-only.

refactored tests for mocha and tweaked some internals #10

Merged
merged 1 commit into from
May 4, 2016

Conversation

davglass
Copy link
Contributor

@davglass davglass commented May 4, 2016

This is a pretty large PR 😄

I did:

  • Convert test suite to mocha
  • Required 100/100/100/100 code coverage
  • Fixed a bug or two while getting to 100^4 code coverage
  • Converted all of the if/else for handling errors to be if (err) { return callback(err); } style
  • Enforced callback on cache.get
  • Replaced deepCopy with lodash.close for perf.
  • Some whitespace tweaks.
  • Added Node 0.12, 4, 5 & 6 to travis config and removed 0.8
  • Bumped the version to 1.0.0

@davglass davglass force-pushed the mocha branch 3 times, most recently from 3f33196 to 471fd35 Compare May 4, 2016 19:32
@davglass
Copy link
Contributor Author

davglass commented May 4, 2016

Woot, tests are all passing now on all node versions..

@davglass
Copy link
Contributor Author

davglass commented May 4, 2016

@bengl @drewfish @vsacheti

- "0.12"
- "4"
Copy link
Contributor

Choose a reason for hiding this comment

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

might as well throw 5 in here. people are using it in prod.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

"yui-lint": "~0.2.0"
},
"dependencies": {
"lodash.clone": "~4.3.2"
Copy link
Contributor

Choose a reason for hiding this comment

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

yay!

}, function (err) {
that.callback(err,dns.internalCache);
describe('dnscache main test suite', function() {
this.timeout(10000); //dns queries are slow..
Copy link
Contributor

Choose a reason for hiding this comment

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

it may be worth stubbing the original dns functions so as to speed up these tests. we shouldn't be interested in testing that require('dns') works... (non-blocker)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, there are also some setTimeout's in the tests too that this was to account for.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah that's dangerous.

@bengl
Copy link
Contributor

bengl commented May 4, 2016

ok LGTM with the following caveats to be sorted out in later PRs:

and one potential doozie (also a non-blocker):

  • either carve out the cache itself into its own module, or use something like lru-cache.

@davglass
Copy link
Contributor Author

davglass commented May 4, 2016

Agreed on all points. I'll work on those items next. Let's just not publish 1.0.0 until we handle those.

@davglass davglass merged commit e393239 into yahoo:master May 4, 2016
@davglass davglass deleted the mocha branch May 4, 2016 20:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants