Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate shape of cacheMap on initialization #86

Merged
merged 6 commits into from
Oct 19, 2017

Conversation

sidsethupathi
Copy link

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

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
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

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
src/index.js Outdated
@@ -305,6 +304,24 @@ function failedDispatch<K, V>(
});
}

function getValidCacheMap<K, V>(
options: Options<K, V>
Copy link
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

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