Skip to content

test : added unit tests for translateText function - #2080

Merged
riteshbonthalakoti merged 1 commit into
riteshbonthalakoti:gssocfrom
tmdeveloper007:#2058
Jun 7, 2026
Merged

test : added unit tests for translateText function#2080
riteshbonthalakoti merged 1 commit into
riteshbonthalakoti:gssocfrom
tmdeveloper007:#2058

Conversation

@tmdeveloper007

Copy link
Copy Markdown

Closes #2058.

Summary of What Has Been Done:
Added unit tests for translateText and SUPPORTED_LANGUAGES in Frontend/src/services/translationService.js.

Changes Made:

  • Created Frontend/src/services/translationService.test.js with 9 test cases
  • Tests same-lang fallback, empty/whitespace inputs, successful API response, HTTP errors, non-200 status, and fetch exceptions
  • Mocks globalThis.fetch for deterministic testing
  • Verifies graceful fallback returns original text on all error paths

Impact it Made:

  • Ensures translation service degrades gracefully when MyMemory API is unavailable
  • Documents the fallback contract for maintainers
  • All 9 tests pass (verified with vitest run)

@vercel

vercel Bot commented Jun 7, 2026

Copy link
Copy Markdown

@tmdeveloper007 is attempting to deploy a commit to the ritesh Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@tmdeveloper007, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 27 minutes and 32 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fc4ec313-f022-455c-ad97-1f3f6b3e8544

📥 Commits

Reviewing files that changed from the base of the PR and between da8faf2 and 2ae5b0c.

📒 Files selected for processing (1)
  • Frontend/src/services/translationService.test.js
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@riteshbonthalakoti
riteshbonthalakoti changed the base branch from main to gssoc June 7, 2026 16:02
@riteshbonthalakoti

Copy link
Copy Markdown
Owner

Superb implementation, @tmdeveloper007! I've successfully resolved all conflicts in your PR and queued it for merging into gssoc.

⚠️ MANDATORY STEPS FOR LEADERBOARD CREDITS:
To ensure you receive full points, please make sure you have taken 10 seconds to:

Keep up the outstanding work! Let's build together! 🔥

@riteshbonthalakoti
riteshbonthalakoti merged commit a3a36a4 into riteshbonthalakoti:gssoc Jun 7, 2026
9 of 10 checks passed
@tmdeveloper007

Copy link
Copy Markdown
Author

Hi @ritesh-1918, this PR was merged but does not have GSSoC labels applied. Could you please add the appropriate labels (e.g. gssoc, gssoc:approved, level:beginner/level:advanced, type:testing/type:bug/type:docs etc.) so the contribution is properly tracked for GSSoC? Thank you!

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.

test : add unit tests for translateText function

2 participants