Add unit tests for core utility and Syncthing components#213
Draft
Add unit tests for core utility and Syncthing components#213
Conversation
- StringExtensionsTests: TrimStart, TrimMatchingQuotes, SplitCommandLine, JoinCommandLine, and a round-trip split/join test - FormatUtilsTests: BytesToHuman across byte/KiB/MiB/GiB boundaries with varying decimal places - ChecksumFileUtilitiesTests: write/validate round-trip, multi-entry lookup, modified-content returns false, missing filename throws - UriExtensionsTests: 0.0.0.0 → 127.0.0.1 replacement, port/path preserved, non-zero hosts unchanged - SyncthingVersionInformationTests: regex version parsing, long version string, empty/invalid inputs fall back to 0.0.0.0 - SyncthingCapabilitiesTests: capability flags below/at/above threshold, default version has no capabilities Co-authored-by: GermanCoding <4279661+GermanCoding@users.noreply.github.com> Agent-Logs-Url: https://github.com/GermanCoding/SyncTrayzor/sessions/6115f602-127e-4878-85ea-6239e317c493
Copilot created this pull request from a session on behalf of
GermanCoding
March 26, 2026 00:24
View session
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.
The codebase had virtually no unit tests. This PR adds focused, non-overfit coverage for the most testable pure-logic components.
New test classes
StringExtensionsTests—TrimStart,TrimMatchingQuotes,SplitCommandLine(quoted args, extra spaces, empty input),JoinCommandLine(space-quoting, embedded quote escaping), and a split↔join round-tripFormatUtilsTests—BytesToHumanacross B/KiB/MiB/GiB unit boundaries with varyingdecimalPlaces; asserts bytes never show decimal places and GiB is the ceiling unitChecksumFileUtilitiesTests— write produces a valid checksum line; validate returnstrue/falsefor matching/modified content; multi-entry file lookup; missing filename throws; full write→validate round-trip viaMemoryStreamUriExtensionsTests—NormalizeZeroHostrewrites0.0.0.0 → 127.0.0.1preserving port and path; leaves all other hosts untouchedSyncthingVersionInformationTests— version regex extraction fromv1.23.4, longer strings likesyncthing v1.2.3, and fallback to0.0.0for empty/non-matching inputSyncthingCapabilitiesTests—SupportsDebugFacilities/SupportsDevicePauseResumeflags correct below, at, and above the introduced-version threshold; default instance (0.0.0) has no capabilitiesAll tests use xunit (already in the test project) and operate entirely in-memory — no UI, disk, or network dependencies.