Skip to content

test: regression coverage for dotenv helpers and S3 key tokens#2

Draft
cursor[bot] wants to merge 1 commit intomainfrom
cursor/regression-test-coverage-f2bc
Draft

test: regression coverage for dotenv helpers and S3 key tokens#2
cursor[bot] wants to merge 1 commit intomainfrom
cursor/regression-test-coverage-f2bc

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor bot commented Apr 2, 2026

Summary

Adds focused unit tests for recently merged dotenv handling and URL-safe S3 object key encoding.

Risky behavior now covered

  • parseDotenv / removeDotenvKey / appendDotenvKey (src/lib/dotenv-parse.ts): parsing edge cases (CRLF, comments, KEY=value with = in value), key removal without stripping comments, append formatting and duplicate-key rejection, and validation errors for invalid keys and multiline values. This logic backs the file workspace and secrets flows; mistakes corrupt or leak .env content.
  • encodeObjectKeyToken / decodeObjectKeyToken (src/lib/key-token.ts): round-trip correctness for UTF-8 keys, padding behavior after URL-safe transforms, and empty keys—reduces risk of broken download/preview links after the base64 URL-safety fix.

Test files added/updated

  • src/lib/dotenv-parse.test.ts (new)
  • src/lib/key-token.test.ts (new)

Why this reduces regression risk

These paths are shared, parsing-heavy, and user-visible. Tests lock in expected parse/remove/append semantics and token encoding so refactors or copy-paste drift between UI and server cannot silently break .env editing or object key resolution.

Validation

  • npm run test (Vitest) — all tests pass; deterministic, no network or env dependencies beyond Node.
Open in Web View Automation 

- Add unit tests for parseDotenv, removeDotenvKey, and appendDotenvKey
  validation and formatting used by secrets UI and TRPC.
- Add encode/decode round-trip tests for URL-safe object key tokens.
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