Skip to content

test: cover SDK UTF-8 base64 helpers#307

Open
saurabhhhcodes wants to merge 1 commit into
AnkanMisra:mainfrom
saurabhhhcodes:test/sdk-base64-260
Open

test: cover SDK UTF-8 base64 helpers#307
saurabhhhcodes wants to merge 1 commit into
AnkanMisra:mainfrom
saurabhhhcodes:test/sdk-base64-260

Conversation

@saurabhhhcodes

@saurabhhhcodes saurabhhhcodes commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add direct Bun tests for the TypeScript SDK UTF-8 Base64 helpers.
  • Cover ASCII, accented, non-Latin, emoji, empty-text encoding, known fixtures, strict invalid-input rejection, and missing atob/btoa runtime errors.
  • Restore overridden globals after capability tests.

Validation

  • cd sdk/typescript && bun run test -- src/tests/base64.test.ts
  • cd sdk/typescript && bun run typecheck
  • git diff --check

Fixes #260

Note

Add tests for SDK UTF-8/base64 helper functions

Adds base64.test.ts to cover encodeUtf8ToBase64 and decodeBase64ToUtf8. Tests include round-trip encoding for ASCII, accented, non-Latin, and emoji strings, a known fixture check, rejection of invalid base64 with a specific error message, and behavior when atob/btoa globals are unavailable. A withoutGlobal helper temporarily removes and restores named globals during tests.

Macroscope summarized 2aff74b.

Summary by CodeRabbit

  • Tests
    • Added coverage for UTF-8 and Base64 encoding and decoding, including Unicode text, empty input, and known fixtures.
    • Added validation for invalid Base64 data and environments without native Base64 support.
    • Confirmed runtime capabilities are restored after testing.

@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the ankanmisra's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added TypeScript TypeScript code type:testing Tests, coverage, fixtures, or validation-only work. labels Jul 15, 2026
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 54d80059-510a-4a00-9633-1c302f13c845

📥 Commits

Reviewing files that changed from the base of the PR and between a65d772 and 2aff74b.

📒 Files selected for processing (1)
  • sdk/typescript/src/__tests__/base64.test.ts

📝 Walkthrough

Walkthrough

Added TypeScript tests covering UTF-8/base64 round trips, empty and known fixture values, invalid inputs, missing atob/btoa capabilities, and restoration of modified globals.

Changes

Base64 helper validation

Layer / File(s) Summary
Base64 helper test coverage
sdk/typescript/src/__tests__/base64.test.ts
Adds Unicode round-trip cases, empty and known fixture assertions, invalid base64 checks, runtime capability tests, and safe restoration of global atob/btoa values.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: ankanmisra

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes Summary and Validation, but omits required template sections like Type Of Change and Affected Areas. Add the missing template sections, especially Type Of Change, Affected Areas, Contributor Checklist, Screenshots, and Notes For Reviewers.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding tests for the SDK UTF-8 base64 helpers.
Linked Issues check ✅ Passed The new Bun tests cover the listed helper round trips, known fixtures, invalid-input errors, runtime guards, and global restoration.
Out of Scope Changes check ✅ Passed The change appears scoped to a new test file and does not introduce unrelated production or configuration changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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.

@AnkanMisra

Copy link
Copy Markdown
Owner

@codex review

@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
microai-paygate Ready Ready Preview, Comment Jul 15, 2026 5:55am

["ASCII", "Hello, world!"],
["accented text", "Café déjà vu"],
["non-Latin text", "नमस्ते мир"],
["emoji", "Paygate 🚀✅"],

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

No emoji's

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 2aff74ba59

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:testing Tests, coverage, fixtures, or validation-only work. TypeScript TypeScript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add SDK unit tests for UTF-8 base64 helpers and runtime guards

2 participants