Skip to content

🧪 Add tests for MetadataEngine SanitizeForPath edge cases#3

Open
gonzoga wants to merge 3 commits into
mainfrom
add-metadata-engine-tests-13391177433328017201
Open

🧪 Add tests for MetadataEngine SanitizeForPath edge cases#3
gonzoga wants to merge 3 commits into
mainfrom
add-metadata-engine-tests-13391177433328017201

Conversation

@gonzoga

@gonzoga gonzoga commented Mar 14, 2026

Copy link
Copy Markdown
Owner

🎯 What: The testing gap addressed
This PR addresses the missing unit tests for the private SanitizeForPath method in MetadataEngine.cs by indirectly testing it via the GetSubFolder method using temporary mock MP3 files generated with TagLib.

📊 Coverage: What scenarios are now tested
The new tests cover:

  • Artist names containing valid path characters mixed with invalid ones (e.g., AC/DC, The:Who, Artist?Name).
  • Edge cases where artist names are empty, whitespace only, or consist entirely of invalid characters (e.g., *:*, ///), correctly falling back to "Unknown" or "Unknown Artist".

Result: The improvement in test coverage
The codebase now safely and robustly verifies how the organizer handles erratic metadata when classifying audio, preventing crashes or filesystem errors upon deployment. To achieve this cleanly in testing, a minimal valid MP3 frame was constructed in memory to ensure TagLib does not throw a CorruptFileException.


PR created automatically by Jules for task 13391177433328017201 started by @gonzoga

Adds `MetadataEngineTests.cs` to explicitly test `GetSubFolder` handling of artist names containing invalid path characters (like '?', '*', ':') and empty strings. Mock MP3 files are generated via TagLib with embedded valid frames to ensure comprehensive and side-effect free metadata testing. Included modifications to allow cross-platform headless testing.

Co-authored-by: gonzoga <6003443+gonzoga@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

google-labs-jules Bot and others added 2 commits March 15, 2026 04:26
Adds `MetadataEngineTests.cs` to explicitly test `GetSubFolder` handling of artist names containing invalid path characters (like '?', '*', ':') and empty strings. Mock MP3 files are generated via TagLib with embedded valid frames to ensure comprehensive and side-effect free metadata testing. Included modifications to allow cross-platform headless testing. Resolved upstream conflicts to include master file assertions.

Co-authored-by: gonzoga <6003443+gonzoga@users.noreply.github.com>
Adds `MetadataEngineTests.cs` explicitly testing `GetSubFolder` handling of artist names containing invalid path characters (like '?', '*', ':') and empty strings. Mock MP3 files are generated via TagLib with embedded valid frames to ensure comprehensive and side-effect free metadata testing. Included modifications to allow cross-platform headless testing. Resolved upstream conflicts to include master file assertions.

Co-authored-by: gonzoga <6003443+gonzoga@users.noreply.github.com>
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