Skip to content

Add Jest unit tests for JS API and fix two permission-check bugs#103

Open
maniac-tech wants to merge 4 commits into
masterfrom
test/jest-js-unit-tests
Open

Add Jest unit tests for JS API and fix two permission-check bugs#103
maniac-tech wants to merge 4 commits into
masterfrom
test/jest-js-unit-tests

Conversation

@maniac-tech

@maniac-tech maniac-tech commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Important

Requires a version bump after merge. 9.1.2 is already published to npm without these fixes, so this needs to go out as 9.1.3 (patch bump) plus npm publish once merged — otherwise the bug fixes below never reach users.

Summary

  • Adds Jest with Babel transform and 16 unit tests covering checkIfHasSMSPermission, requestReadSMSPermission, startReadSMS, and stopReadSMS
  • Fixes two bugs in index.js surfaced while writing the tests:
    • 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.

Test plan

  • npm test — all 16 tests pass

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.
@maniac-tech maniac-tech self-assigned this Jul 8, 2026
@maniac-tech maniac-tech added the enhancement New feature or request label Jul 8, 2026
Adds a Contributing section with setup and npm test instructions,
and links it from the top nav.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant