Files
Michael Kriese 7960e5d077 test(workers/repository): close more branch coverage gaps (#46254)
* test(workers/repository): cover the pr note and closed-pr guards

`handle-existing.ts` had no spec of its own and was only reached through
the branch worker, so none of its early exits were exercised. Give it
one, covering an open pr, a suppressed notification, a branch that is
already gone, each of the three ignore messages, and both dry-run paths
in each function.

Also cover a pr body with no notes at all, extra notes where none of the
three conditions hold, and a config warning issue raised from an error
that carries no validation details and whose issue is neither created
nor updated.

Co-authored-by: Claude Opus 5 <michael.kriese+claude-code@mend.io>

* test(workers/repository): cover five config migration guards

- a `package.json` that carries no `renovate` key, so nothing is deleted
  from it before it is rewritten
- a platform with no `refreshPr`, which the migration branch check has to
  tolerate
- an old migration branch that is already gone, so there is nothing to
  delete before the new one is created
- an editorconfig that sets no maximum line length
- a migration pr with no footer configured

The platform case redefines `refreshPr` rather than deleting it: the
mocked module object refuses deletion but allows redefinition.

Co-authored-by: Claude Opus 5 <michael.kriese+claude-code@mend.io>

* test(workers/repository): cover the onboarding and reconfigure caches

- deleting and updating the onboarding cache when there is no cache
- an onboarding pr whose closing comment is suppressed
- a reconfigure cache written together with an extract result

Also drop the `if (extractResult)` in the reconfigure check: the catch
above it returns, so the variable is always set by the time the comment
is ensured, and the compiler narrows it on its own.

Co-authored-by: Claude Opus 5 <michael.kriese+claude-code@mend.io>

* test(workers/repository): cover the update flattening guards

- a config whose `semanticCommits` is already decided, so no detection
  runs while flattening
- a semantic commit with no scope configured

Also drop the first `packagePath.length > 0` check while flattening:
`String.split` always yields at least one element, so there is always a
file name to drop. The check after the splice stays, since that one can
leave the array empty.

Co-authored-by: Claude Opus 5 <michael.kriese+claude-code@mend.io>

* ci: ratchet the branch coverage threshold

A full run on this branch reports 100% statements (49468/49468), 100%
functions (7381/7381), 100% lines (48958/48958) and 99.82% branches
(25709/25755), up from 99.73% on the branch below. The threshold moves to
99.80, keeping the same rounding-down margin as before.

Statements, functions and lines are already pinned at 100 and stay
there.

Co-authored-by: Claude Opus 5 <michael.kriese+claude-code@mend.io>

* Apply suggestion from `@secustor`

Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>

---------

Co-authored-by: Claude Opus 5 <michael.kriese+claude-code@mend.io>
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
2026-09-17 07:08:46 +00:00
..