Repository navigation
Rebuild seminar/transport test steps on two generic primitives - #140
Merged
Merged
Conversation
Replaces the ad-hoc per-flow helpers with a small tree: - ask()/askThenReject() are the only two functions that touch the YemotScenarioBuilder directly - every named step (respondToTz, askForKlass, confirmDeparture, etc.) is now a 1-line call into one of those two, parameterized by a named prompt-regex constant - reportAbsentStudent/rejectAbsentStudentName merged into a single confirmsStudentName(builder, num, accept) Net +7 lines (40 insertions / 33 deletions) — trades a few more small named functions for eliminating all regex/builder-call duplication; every step is now traceable to one of two primitives. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MX2QnzzPvash7UmemgUPL9
buzz-code
force-pushed
the
claude/year-start-august-s6zrjt
branch
from
August 18, 2026 06:15
19b9601 to
a07edce
Compare
There was a problem hiding this comment.
Pull request overview
Refactor Yemot scenario-step helpers in server/src/yemot-handler.service.test.ts into 2 generic primitives plus shared prompt-regex constants, shrinking duplicated builder-call sequences in transport + seminar-attendance tests.
Changes:
- Add prompt-regex constants (TZ/transport/departure/klass/absent-student/confirm-student).
- Add
ask()+askThenReject()primitives, rewrite step helpers to delegate. - Merge absent-student “enter number + confirm name” helpers into
confirmsStudentName().
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| const ABSENT_STUDENT_PROMPT = /enter absent student number/i; | ||
| const CONFIRM_STUDENT_PROMPT = /confirm student/i; | ||
|
|
||
| // ---- Generic scenario-step primitives — every step below is one of these ---- |
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.
Summary
Full from-scratch redesign of the scenario-step helpers in
yemot-handler.service.test.ts, requested as a follow-up to #138/#139.Every step in the file (transport TZ/transport/departure, seminar klass/student prompts) is one of two shapes: a single ask+respond exchange, or that same exchange followed by an error
systemSends. Collapsed the whole helper section onto:ask(builder, prompt, response)andaskThenReject(builder, prompt, response, errorMessage)— the only two functions that call theYemotScenarioBuilderdirectly.TZ_PROMPT,TRANSPORT_PROMPT,DEPARTURE_PROMPT,KLASS_PROMPT,ABSENT_STUDENT_PROMPT,CONFIRM_STUDENT_PROMPT) replacing the regex literals that used to be duplicated inline across 2-3 functions each.respondToTz,rejectTz,respondToTransport,rejectTransport,confirmDeparture,askForKlass,rejectKlass,rejectStudentNumber,finishAbsentStudentEntry) is now a 1-line call into a primitive + its prompt constant.reportAbsentStudent/rejectAbsentStudentName(7 and 8 lines) merged into oneconfirmsStudentName(builder, studentNumber, accept)(4 lines) — same two-step "enter number, then confirm yes/no" shape, previously duplicated.welcomesTeacher,entersKlass,startsSeminarCallunchanged — genuinely multi-step composites reused 2+ times, kept as named functions on top of the primitives.Function tree:
Net +7 lines (40 insertions / 33 deletions) — more small named functions, but every one is now a single line with no duplicated regex or builder-call sequence; every step traces to exactly one of the two primitives.
Testing
Full server suite: 100 suites / 941 tests passing.
🤖 Generated with Claude Code
Generated by Claude Code