Skip to content

[Test Improver] tests: add unit tests for useUserRetentionValidation composable - #18660

Draft
github-actions[bot] wants to merge 2 commits into
masterfrom
test-assist/user-retention-validation-tests-ae9551acccec5d17
Draft

[Test Improver] tests: add unit tests for useUserRetentionValidation composable#18660
github-actions[bot] wants to merge 2 commits into
masterfrom
test-assist/user-retention-validation-tests-ae9551acccec5d17

Conversation

@github-actions

@github-actions github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🤖 This PR was created by Test Improver, an automated AI assistant focused on improving test coverage.

Goal and Rationale

Add unit tests for shell/composables/useUserRetentionValidation.ts, a composable containing user retention validation logic with multiple branches and edge cases — previously at 0% coverage.

This composable validates:

  • Cron expressions for scheduled user retention jobs
  • Duration strings for disabling/deleting inactive users
  • Minimum duration enforcement (336h)
  • Duration comparisons against the auth user session TTL

Approach

  • Mocked useI18n and vuex to isolate pure validation logic
  • Used a makeComposable() helper to construct the composable with reactive refs
  • Split it.each tables into separate pass/fail blocks to comply with jest/no-conditional-expect ESLint rule
  • Covered boundary conditions (exactly 336h), null inputs, empty strings, and the regex quirk in parseDuration (alternation without full anchoring matches leading unit in multi-unit strings)

Coverage Impact

Metric Before After
Statements 0% 97.4%
Branches 0% 89.5%
Functions 0% 100%

Test Status

✅ 27 tests pass
✅ ESLint clean (--max-warnings 0)

Reproducing

node_modules/.bin/jest --no-coverage shell/composables/__tests__/useUserRetentionValidation.test.ts

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • download.cypress.io

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "download.cypress.io"

See Network Configuration for more information.

Generated by Daily Test Improver · sonnet46 153.2 AIC · ⌖ 6.78 AIC · ⊞ 12.8K ·
Comment /test-assist to run again

github-actions Bot and others added 2 commits August 6, 2026 09:18
Cover validateUserRetentionCron, validateDisableInactiveUserAfterDuration,
validateDeleteInactiveUserAfterDuration, validateDeleteInactiveUserAfter,
and validateDurationAgainstAuthUserSession — including happy paths, error
paths, boundary conditions (336h minimum), and null/empty edge cases.

Coverage: 0% → 97.4% stmts, 89.5% branches, 100% fns

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@marcelofukumoto
marcelofukumoto force-pushed the test-assist/user-retention-validation-tests-ae9551acccec5d17 branch from bd8b7f8 to 1acc6b5 Compare August 6, 2026 07:26
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Auto-Retry Failed Run

The Tests workflow failed for the commits below and has been automatically retried.
Follow up on a retried run through its link if needed.

Commit Workflow run Retried at
1acc6b5 31080952091 2026-08-06 08:15 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant