test: regression coverage for dotenv helpers and S3 key tokens#2
Draft
cursor[bot] wants to merge 1 commit intomainfrom
Draft
test: regression coverage for dotenv helpers and S3 key tokens#2cursor[bot] wants to merge 1 commit intomainfrom
cursor[bot] wants to merge 1 commit intomainfrom
Conversation
- 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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=valuewith=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.envcontent.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
.envediting or object key resolution.Validation
npm run test(Vitest) — all tests pass; deterministic, no network or env dependencies beyond Node.