Background
SeasonsService.findActive (src/seasons/seasons.service.ts) returns the
active season where starts_at <= now < ends_at. If no such season exists, the
QueryBuilder .getOne() returns null. The existing season tests do not verify
the no-active-season case — there may be a missing null check that throws an
unexpected error.
Goal
Add tests for the no-active-season case in src/seasons/seasons.service.spec.ts
(create if absent).
Requirements
-
No season at all: mock query returns null; assert findActive returns
null (or throws NotFoundException — verify the current implementation
and match it).
-
Season exists but window hasn't started: season with
starts_at = future; mock returns null; assert null returned.
Acceptance criteria
- No crashes when no active season exists.
- Correct season returned when one matches.
Background
SeasonsService.findActive(src/seasons/seasons.service.ts) returns theactive season where
starts_at <= now < ends_at. If no such season exists, theQueryBuilder
.getOne()returnsnull. The existing season tests do not verifythe no-active-season case — there may be a missing null check that throws an
unexpected error.
Goal
Add tests for the no-active-season case in
src/seasons/seasons.service.spec.ts(create if absent).
Requirements
No season at all: mock query returns null; assert
findActivereturnsnull(or throwsNotFoundException— verify the current implementationand match it).
Season exists but window hasn't started: season with
starts_at = future; mock returns null; assert null returned.Acceptance criteria