refactor(registratie): extract the read half of createDraftSync (RB-21)
createDraftSync mixed a read path (findConcept, load, the read half of resume) with its write path (ensureId, flush, submit, reset) in one 187-line function -- CQ-001's finding. Move findConcept and loadConcept into a new application/find-concept.ts as free functions that take the adapter, so they get a direct spec with no Angular TestBed. createDraftSync keeps the closure state (id, ensuring, resumeGate) and the whole write path unchanged -- this is a move, not a redesign. The resumeGate coupling that lets the write path wait for the read path stays exactly where it was. createDraftSync shrinks from 187 to 169 lines. draft-sync.spec.ts is unchanged -- it never called resume()/load() directly, and its 409 recovery test for submit() still exercises the extracted findConcept through ensureId's catch branch. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,7 @@ tested where._
|
||||
|
||||
Every bullet below is a real test name from the suite — an `it()` title (frontend) or a test
|
||||
method name (backend), read as a sentence. Nothing here is hand-written prose: this page
|
||||
**is** the suite, reshaped for a business reader. 451 frontend behaviours across
|
||||
**is** the suite, reshaped for a business reader. 460 frontend behaviours across
|
||||
9 contexts; 236 backend behaviours across 41 test
|
||||
classes.
|
||||
|
||||
@@ -470,6 +470,14 @@ classes.
|
||||
- lists soort/waarvoor/status/referentie/ingediend, plus reason when rejected
|
||||
- reference falls back to em dash for a Concept
|
||||
|
||||
#### findConcept
|
||||
|
||||
- returns the id of the existing Concept of the given type
|
||||
- returns undefined when the list has no application of the given type
|
||||
- returns undefined when the matching type is not a Concept
|
||||
- returns undefined when adapter.list() resolves with an unparsable shape
|
||||
- returns undefined when adapter.list() rejects
|
||||
|
||||
#### hasProgress
|
||||
|
||||
- is false for a fresh wizard
|
||||
@@ -486,6 +494,13 @@ classes.
|
||||
|
||||
- derives the beroep from the chosen diploma and flags origin duo
|
||||
|
||||
#### loadConcept
|
||||
|
||||
- reads the draft off a Concept
|
||||
- reports a missing draft as null
|
||||
- reports not-concept when the id has moved past Concept (submitted)
|
||||
- reports not-concept when the id is unknown or deleted (detail rejects)
|
||||
|
||||
#### manual diploma fallback
|
||||
|
||||
- KiesHandmatig flags handmatig with the maximal question set and no beroep yet
|
||||
|
||||
Reference in New Issue
Block a user