Add Jest unit tests for JS API and fix two permission-check bugs#103
Open
maniac-tech wants to merge 4 commits into
Open
Add Jest unit tests for JS API and fix two permission-check bugs#103maniac-tech wants to merge 4 commits into
maniac-tech wants to merge 4 commits into
Conversation
Adds Jest with Babel transform and 16 tests covering checkIfHasSMSPermission, requestReadSMSPermission, startReadSMS, and stopReadSMS. Writing the tests surfaced two bugs in index.js, now fixed: - startReadSMS checked truthiness of the permission-status object instead of its boolean fields, so the missing-permission error path was unreachable. - requestReadSMSPermission compared PermissionsAndroid.requestMultiple's per-permission result map against a single result string, so it always returned false even when both permissions were granted.
Adds a Contributing section with setup and npm test instructions, and links it from the top nav.
…ests # Conflicts: # package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Requires a version bump after merge.
9.1.2is already published to npm without these fixes, so this needs to go out as9.1.3(patch bump) plusnpm publishonce merged — otherwise the bug fixes below never reach users.Summary
checkIfHasSMSPermission,requestReadSMSPermission,startReadSMS, andstopReadSMSindex.jssurfaced while writing the tests:startReadSMSchecked truthiness of the permission-status object instead of its boolean fields, so the missing-permission error path was unreachable.requestReadSMSPermissioncomparedPermissionsAndroid.requestMultiple's per-permission result map against a single result string, so it always returnedfalseeven when both permissions were granted.Test plan
npm test— all 16 tests pass