feat(scope): add current Meta permissions#1662
Conversation
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~4 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/java/com/restfb/scope/FacebookPermissions.java (1)
304-322: Add focused tests for the new permission strings to prevent silent typos.Since
ScopeBuilderserializes these viagetPermissionString(), a compact test covering the newly added constants would lock in expected wire values and reduce regression risk.✅ Suggested test addition (example)
diff --git a/src/test/java/com/restfb/scope/ScopeBuilderTest.java b/src/test/java/com/restfb/scope/ScopeBuilderTest.java @@ `@Test` + void newMetaPermissionsAreSerializedCorrectly() { + ScopeBuilder s = new ScopeBuilder(true); + s.addPermission(FacebookPermissions.FACEBOOK_BRANDED_CONTENT_ADS_BRAND) + .addPermission(FacebookPermissions.MARKETING_MESSAGES_MESSENGER) + .addPermission(FacebookPermissions.PAGES_UTILITY_MESSAGING) + .addPermission(FacebookPermissions.MANAGE_APP_SOLUTIONS) + .addPermission(FacebookPermissions.MANAGE_FUNDRAISERS) + .addPermission(FacebookPermissions.INSTAGRAM_CREATOR_MARKETPLACE_DISCOVERY) + .addPermission(FacebookPermissions.INSTAGRAM_CREATOR_MARKETPLACE_MESSAGING) + .addPermission(FacebookPermissions.INSTAGRAM_MANAGE_CONTENTS) + .addPermission(FacebookPermissions.INSTAGRAM_MANAGE_ENGAGEMENT) + .addPermission(FacebookPermissions.INSTAGRAM_MANAGE_UPCOMING_EVENTS) + .addPermission(FacebookPermissions.WHATSAPP_BUSINESS_MANAGE_EVENTS) + .addPermission(FacebookPermissions.THREADS_SHARE_TO_INSTAGRAM); + + assertThat(s).hasToString( + "facebook_branded_content_ads_brand,marketing_messages_messenger,pages_utility_messaging," + + "manage_app_solutions,manage_fundraisers,instagram_creator_marketplace_discovery," + + "instagram_creator_marketplace_messaging,instagram_manage_contents,instagram_manage_engagement," + + "instagram_manage_upcoming_events,whatsapp_business_manage_events,threads_share_to_instagram" + ); + } + + `@Test` void multiPermissions() {Also applies to: 476-484, 538-545, 746-763, 828-887, 1080-1088, 1251-1258
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/java/com/restfb/scope/FacebookPermissions.java` around lines 304 - 322, Add focused unit tests that assert each new FacebookPermissions enum constant serializes to the exact expected wire string via ScopeBuilder.getPermissionString(); for example verify FACEBOOK_BRANDED_CONTENT_ADS_BRAND and FACEBOOK_CREATOR_MARKETPLACE_DISCOVERY return "facebook_branded_content_ads_brand" and "facebook_creator_marketplace_discovery" respectively. Create a compact test (e.g., FacebookPermissionsTest) that enumerates the newly added constants (including the other ranges called out) and compares permission.getPermissionString() against the hard-coded expected literal for each to catch silent typos. Ensure tests fail on mismatch and cover all newly introduced constants referenced in the review comment.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/main/java/com/restfb/scope/FacebookPermissions.java`:
- Around line 304-322: Add focused unit tests that assert each new
FacebookPermissions enum constant serializes to the exact expected wire string
via ScopeBuilder.getPermissionString(); for example verify
FACEBOOK_BRANDED_CONTENT_ADS_BRAND and FACEBOOK_CREATOR_MARKETPLACE_DISCOVERY
return "facebook_branded_content_ads_brand" and
"facebook_creator_marketplace_discovery" respectively. Create a compact test
(e.g., FacebookPermissionsTest) that enumerates the newly added constants
(including the other ranges called out) and compares
permission.getPermissionString() against the hard-coded expected literal for
each to catch silent typos. Ensure tests fail on mismatch and cover all newly
introduced constants referenced in the review comment.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d6634d0e-c6dc-4f81-a731-70c9886ebc30
📒 Files selected for processing (1)
src/main/java/com/restfb/scope/FacebookPermissions.java
Summary by CodeRabbit
New Features
Documentation