Skip to content

Implement skipped Yemot handler tests - #92

Merged
buzz-code merged 1 commit into
mainfrom
impl-skipped-tests-yemot
Jun 23, 2026
Merged

buzz-code merged 1 commit into
mainfrom
impl-skipped-tests-yemot

Conversation

@buzz-code

Copy link
Copy Markdown
Owner

Summary

Implements the three it.skip stub tests in server/src/yemot-handler.service.test.ts, covering previously untested branches in YemotHandlerService.

Changes

All three tests use the existing YemotScenarioBuilder / YemotScenarioRunner testing utilities:

  1. no class found — hangup with STUDENT.NO_CLASS — Seeds Student and Transportation but omits StudentKlass, then follows the happy path (valid TZ → valid transport → confirm departure). Verifies the handler hangs up with STUDENT.NO_CLASS when no class association is found in createAbsenceRecord.

  2. past deadline — exactly at 8:50, hangup with CLOSED — Sets the system time to exactly 8:50 Israel time. Verifies the boundary condition in isPastReportingDeadline (hour === 8 && minute >= 50) triggers an immediate hangup with SYSTEM.CLOSED.

  3. before deadline — at 8:49, continues to student input — Sets the system time to 8:49 Israel time. Verifies the deadline check passes and the call proceeds through the full happy path to a successful report.

Verification

All 9 tests pass:

✓ past deadline — immediate hangup with CLOSED
✓ happy path — valid TZ, valid transport, confirmed departure
✓ invalid TZ — error message then retry with valid TZ
✓ already reported today — hangup with ALREADY_REPORTED
✓ invalid transport — error message then retry with valid transport
✓ late departure — user says no to confirmation, hangup with LATE_DEPARTURE
✓ no class found — hangup with STUDENT.NO_CLASS
✓ past deadline — exactly at 8:50, hangup with CLOSED
✓ before deadline — at 8:49, continues to student input

Tests: 9 passed, 9 total

Implement the three it.skip stub tests in yemot-handler.service.test.ts:

1. 'no class found' — seeds Student and Transportation without StudentKlass,
   verifies hangup with STUDENT.NO_CLASS message.

2. 'past deadline at 8:50' — sets time to exactly 8:50, verifies the
   boundary condition triggers hangup with SYSTEM.CLOSED.

3. 'before deadline at 8:49' — sets time to 8:49, verifies the deadline
   check passes and the call continues to student input and completes
   the happy path.
@buzz-code
buzz-code merged commit 2e2b6ca into main Jun 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant