Skip to content

Validate shape of cacheMap on initialization#86

Merged
leebyron merged 6 commits into
graphql:masterfrom
sidsethupathi:cache-map-shape
Oct 19, 2017
Merged

Validate shape of cacheMap on initialization#86
leebyron merged 6 commits into
graphql:masterfrom
sidsethupathi:cache-map-shape

Conversation

@sidsethupathi
Copy link
Copy Markdown

Addresses #82

Checks to see if custom cache map has the required methods on initialization. The documentation just says it needs to be an object with a similar API to Map but the DataLoader only uses those 4 methods, so I figured it was okay to selectively check for those.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.4%) to 99.611% when pulling bdf8e0b on sidsethupathi:cache-map-shape into c7f047e on facebook:master.

@sidsethupathi
Copy link
Copy Markdown
Author

sidsethupathi commented Jun 15, 2017

Hmm, I'm having some trouble figuring out how code coverage dropped. It looks like the new test should exercise the added functionality, but maybe I'm overlooking something simple.

EDIT: Turns out it was untested lines in the new test.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling e323ec6 on sidsethupathi:cache-map-shape into c7f047e on facebook:master.

* Functions should avoid being defined within another function body if possible
* Naming consistency
* Flow typing
* Arrow functions with a single return statement should not use block format
* Check typeof 'function' instead of non-falsey
* filter(Boolean) to remove falsey values
Comment thread src/index.js Outdated
}

function getValidCacheMap<K, V>(
options: Options<K, V>
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'm pretty new to flow, but shouldn't this be options??

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling f020aed on sidsethupathi:cache-map-shape into c7f047e on facebook:master.

@leebyron leebyron merged commit dc3f0cd into graphql:master Oct 19, 2017
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.

3 participants