Skip to content

RR-T42 Bug fixes#111

Merged
ucswift merged 1 commit intomasterfrom
develop
Mar 20, 2026
Merged

RR-T42 Bug fixes#111
ucswift merged 1 commit intomasterfrom
develop

Conversation

@ucswift
Copy link
Member

@ucswift ucswift commented Mar 20, 2026

Summary by CodeRabbit

  • Tests

    • Enhanced Jest test infrastructure with mocks for localization, device wake-lock functionality, and UI components.
  • Localization

    • Updated translation keys and content across multiple languages (Arabic, English, Spanish, Polish) to improve language selector consistency.
  • Style

    • Minor JSX formatting adjustment in login form component.

@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2026

📝 Walkthrough

Walkthrough

This PR establishes Jest mock infrastructure for Expo libraries and extends existing React Native mocks with I18nManager support. New mocks are created for expo-keep-awake and expo-localization, test mocks are added for the login form, translation files are updated with reordered language keys, and the login form component receives minor JSX reformatting.

Changes

Cohort / File(s) Summary
Expo and React Native Jest Mocks
__mocks__/expo-keep-awake.ts, __mocks__/expo-localization.ts, __mocks__/react-native.ts, jest-setup.ts
Created new mock modules for expo-keep-awake with async and sync mock functions; added expo-localization mock with locale, calendar, and RTL data; extended React Native mock with I18nManager API including allowRTL, forceRTL, and isRTL state.
Login Form Test Setup
src/app/login/__tests__/login-form.test.tsx
Added Jest mocks for Select component hierarchy, extended React Native mock with I18nManager, added GlobeIcon to icon mocks, and configured react-i18next mock with initReactI18next plugin support.
Login Form Component
src/app/login/login-form.tsx
Reformatted Select component JSX from multi-line to single-line syntax without functional changes.
Translation Files
src/translations/ar.json, src/translations/en.json, src/translations/es.json, src/translations/pl.json
Reordered language selection keys in login/settings sections across multiple translation files; updated Polish translation string with Unicode escape sequences for special quotation characters.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 Hops of joy through mock arrays,
Locale whispers, RTL sways,
Languages dance in JSON files so bright,
Test setup springs—all mocks in sight! 🌍✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'RR-T42 Bug fixes' is vague and generic, using non-descriptive terms that don't convey what specific bugs are being fixed or the main focus of the changeset. Replace with a more specific title that describes the primary change, such as 'Add Jest mocks for expo-keep-awake and expo-localization with i18n support' or 'Add internationalization and RTL support mocks for testing'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch develop

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@__mocks__/react-native.ts`:
- Around line 37-41: The I18nManager mock is missing the swapLeftAndRightInRTL
property used in jest-setup.ts and src/app/login/__tests__/login-form.test.tsx;
update the I18nManager export in __mocks__/react-native.ts to include
swapLeftAndRightInRTL (as a jest.fn() or boolean as appropriate for the mock) so
the mock API matches the real I18nManager and the tests that call
swapLeftAndRightInRTL do not get undefined.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d4de7e79-5102-44a5-b1ee-7ad25c60a24a

📥 Commits

Reviewing files that changed from the base of the PR and between 113c4d2 and 58085b9.

📒 Files selected for processing (10)
  • __mocks__/expo-keep-awake.ts
  • __mocks__/expo-localization.ts
  • __mocks__/react-native.ts
  • jest-setup.ts
  • src/app/login/__tests__/login-form.test.tsx
  • src/app/login/login-form.tsx
  • src/translations/ar.json
  • src/translations/en.json
  • src/translations/es.json
  • src/translations/pl.json

Comment on lines +37 to +41
export const I18nManager = {
allowRTL: jest.fn(),
forceRTL: jest.fn(),
isRTL: false,
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== I18nManager usage and API members =="
rg -n -C2 '\bI18nManager\b|\bswapLeftAndRightInRTL\b' --type ts --type tsx

echo
echo "== __mocks__/react-native.ts excerpt =="
sed -n '30,80p' __mocks__/react-native.ts

echo
echo "== jest-setup.ts excerpt =="
sed -n '318,336p' jest-setup.ts

Repository: Resgrid/Responder

Length of output: 145


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== __mocks__/react-native.ts (lines 30-80) =="
cat -n __mocks__/react-native.ts | sed -n '30,80p'

echo
echo "== jest-setup.ts (searching for I18nManager) =="
grep -n -A5 'I18nManager' jest-setup.ts || echo "Not found in jest-setup.ts"

echo
echo "== Search for swapLeftAndRightInRTL usage =="
rg -n 'swapLeftAndRightInRTL' || echo "No matches found"

echo
echo "== Search for I18nManager usage across codebase =="
rg -n 'I18nManager' -t ts || echo "No matches in .ts files"

Repository: Resgrid/Responder

Length of output: 2370


Add swapLeftAndRightInRTL to keep I18nManager mock API consistent.

The I18nManager mock at lines 37-41 is missing swapLeftAndRightInRTL, which is defined in jest-setup.ts and actively used in src/app/login/__tests__/login-form.test.tsx. This API surface mismatch can cause undefined behavior if tests import from __mocks__/react-native.ts instead of relying on the jest-setup definition.

🔧 Proposed fix
 export const I18nManager = {
   allowRTL: jest.fn(),
   forceRTL: jest.fn(),
+  swapLeftAndRightInRTL: jest.fn(),
   isRTL: false,
 };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export const I18nManager = {
allowRTL: jest.fn(),
forceRTL: jest.fn(),
isRTL: false,
};
export const I18nManager = {
allowRTL: jest.fn(),
forceRTL: jest.fn(),
swapLeftAndRightInRTL: jest.fn(),
isRTL: false,
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@__mocks__/react-native.ts` around lines 37 - 41, The I18nManager mock is
missing the swapLeftAndRightInRTL property used in jest-setup.ts and
src/app/login/__tests__/login-form.test.tsx; update the I18nManager export in
__mocks__/react-native.ts to include swapLeftAndRightInRTL (as a jest.fn() or
boolean as appropriate for the mock) so the mock API matches the real
I18nManager and the tests that call swapLeftAndRightInRTL do not get undefined.

@ucswift
Copy link
Member Author

ucswift commented Mar 20, 2026

Approve

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is approved.

@ucswift ucswift merged commit f6e22ba into master Mar 20, 2026
13 of 14 checks passed
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.

1 participant