test(admin-ui): license flow test cases (#2904)#2906
Conversation
|
Caution Review failedAn error occurred during the review process. Please try again later. 📝 WalkthroughWalkthroughAdds tests for the license reducer and listener, license-gated UI wrappers, SSA upload interactions, and GluuDynamicList behavior. ChangesAdmin UI license-flow tests
Admin UI DynamicList tests
Sequence Diagram(s)Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 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 |
Signed-off-by: faisalsiddique4400 <faisalsiddique10886@gmail.com>
Signed-off-by: faisalsiddique4400 <faisalsiddique10886@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@admin-ui/app/components/GluuDynamicList/__tests__/GluuDynamicList.test.tsx`:
- Around line 188-192: The whitespace-only error test is vacuous because it
never queries the actual rendered error from GluuDynamicList. Update the
GluuDynamicList.test.tsx case to target the real error output from
renderList/showError handling, using the component’s rendered error node or
accessible query instead of the unrelated literal “Bad input”. Verify a
non-empty error renders first, then assert the whitespace-only errorMessage is
suppressed and that the assertion reflects error rendering rather than the empty
items state.
In `@admin-ui/app/redux/listeners/__tests__/licenseListener.test.ts`:
- Around line 59-63: The listener tests in licenseListener.test.ts currently
only assert final slice state and miss the token/bootstrap and request-shape
contract. Update the affected cases around the listener setup and adminuiPostSsa
calls to verify fetchApiTokenWithDefaultScopes is invoked, that the returned
access_token is passed through to the API client, and that forwarded request
data such as the SSA JWT is included in the adminuiPostSsa arguments. Use the
existing test helpers and mockedFetchToken/store setup to assert these boundary
interactions in the relevant license listener flows.
- Line 42: The test helper flush in licenseListener.test.ts is a timing guess
and should be removed in favor of waiting for the actual Redux state change.
Update the affected tests around the listener dispatch flows to assert on the
observed store state or expected action effects using a retry/wait pattern tied
to the specific state transition, rather than setTimeout(0). Use the existing
test cases and listener-triggering helpers in licenseListener.test.ts to locate
each flush call and replace it with deterministic assertions that only pass once
the listener chain has completed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 49ee5e52-caea-472e-be0f-b9c126a9ff80
📒 Files selected for processing (13)
admin-ui/app/components/CustomInput/__tests__/CustomInput.test.tsxadmin-ui/app/components/GluuDatePicker/__tests__/GluuDatePicker.test.tsxadmin-ui/app/components/GluuDropdown/__tests__/GluuDropdown.test.tsxadmin-ui/app/components/GluuDynamicList/__tests__/GluuDynamicList.test.tsxadmin-ui/app/components/GluuSearchToolbar/__tests__/GluuSearchToolbar.test.tsxadmin-ui/app/components/Sidebar/__tests__/Sidebar.test.tsxadmin-ui/app/redux/features/__tests__/licenseSlice.test.tsadmin-ui/app/redux/listeners/__tests__/licenseListener.test.tsadmin-ui/app/routes/Apps/Gluu/__tests__/GluuInputEditor.test.tsxadmin-ui/app/routes/Apps/Gluu/__tests__/GluuThemeFormFooter.test.tsxadmin-ui/app/utils/__tests__/ApiKeyRedirect.test.tsxadmin-ui/app/utils/__tests__/AppAuthProvider.test.tsxadmin-ui/app/utils/__tests__/UploadSSA.test.tsx
710a0cc to
d69b10a
Compare
Signed-off-by: faisalsiddique4400 <faisalsiddique10886@gmail.com>
Signed-off-by: faisalsiddique4400 <faisalsiddique10886@gmail.com>
|



test(admin-ui): license flow test cases (#2904)
Summary
This PR adds comprehensive Jest test coverage for the Admin UI License flow, including mocked API interactions for every stage of the license lifecycle.
The tests validate configuration verification, SSA upload, license activation, MAU threshold enforcement, trial license generation, and failure scenarios to ensure the License workflow behaves correctly under both successful and error conditions.
Fix Summary
licenseKeyreturned by the retrieve endpointlicense-keyreturned by the trial endpointVerification
passes successfully.
🔗 Ticket
Closes: #2904
Summary by CodeRabbit