You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ConnectDateUtils.kt contains date parsing logic used across ConnectID features:
convertIsoDate() β strips fractional seconds, normalises +00:00 β Z, parses ISO 8601 strings, and formats output. Date parsing bugs here can cause data display issues or crashes.
parseIsoDateForSorting() β parses ISO dates for chronological ordering; returns null on failure.
Neither function had any test coverage. This PR adds targeted tests for the non-trivial parsing branches.
Approach
New test class: app/unit-tests/src/org/commcare/connect/ConnectDateUtilsTest.kt
convertIsoDate tests:
Valid standard ISO format parses without error
Fractional seconds (.123456) are stripped before parsing; result matches clean version
+00:00 offset is normalised to Z; result matches Z version
Empty string throws IllegalArgumentException (guarded by require)
Invalid format throws ParseException
outputStyle parameter is respected (SHORT β€ MEDIUM length)
Same input produces identical output (no hidden state)
Parsed epoch matches reference parse result (UTC correctness)
Earlier date sorts before later date
Coverage Impact
No baseline numbers available (commcare-core sibling not present in this environment; coverage runs via CI JaCoCo). Both methods were previously untested.
Trade-offs
Tests focus on the parsing/cleaning logic only; formatNotificationTime (which requires Context string resources) is left for a follow-up.
Output format assertions use relative comparisons (e.g., SHORT length β€ MEDIUM) to avoid locale fragility.
Test Status
Build not runnable locally (requires ../commcare-core sibling directory, checked out only in CI). Tests follow existing patterns from ConnectReleaseTogglesParserTest and FileUtilTest and should compile and pass in CI.
gh aw add githubnext/agentics/workflows/daily-test-improver.md@346204513ecfa08b81566450d7d599556807389f
Note
This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch test-assist/connect-date-utils-tests-20a1a4ae812e4ee6.
π€ Test Improver β automated AI assistant
Goal and Rationale
ConnectDateUtils.ktcontains date parsing logic used across ConnectID features:convertIsoDate()β strips fractional seconds, normalises+00:00βZ, parses ISO 8601 strings, and formats output. Date parsing bugs here can cause data display issues or crashes.parseIsoDateForSorting()β parses ISO dates for chronological ordering; returnsnullon failure.Neither function had any test coverage. This PR adds targeted tests for the non-trivial parsing branches.
Approach
New test class:
app/unit-tests/src/org/commcare/connect/ConnectDateUtilsTest.ktconvertIsoDatetests:.123456) are stripped before parsing; result matches clean version+00:00offset is normalised toZ; result matches Z versionIllegalArgumentException(guarded byrequire)ParseExceptionoutputStyleparameter is respected (SHORT β€ MEDIUM length)parseIsoDateForSortingtests:Datenullnull(swallowsParseException)Coverage Impact
No baseline numbers available (commcare-core sibling not present in this environment; coverage runs via CI JaCoCo). Both methods were previously untested.
Trade-offs
formatNotificationTime(which requiresContextstring resources) is left for a follow-up.Test Status
Build not runnable locally (requires
../commcare-coresibling directory, checked out only in CI). Tests follow existing patterns fromConnectReleaseTogglesParserTestandFileUtilTestand should compile and pass in CI.To run:
Note
This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch
test-assist/connect-date-utils-tests-20a1a4ae812e4ee6.Click here to create the pull request
To fix the permissions issue, go to Settings β Actions β General and enable Allow GitHub Actions to create and approve pull requests.
Show patch preview (138 of 138 lines)