Skip to content

[Backend] — Test: SeasonsService.findActive returns null when no season window matches now #1147

Description

@Olowodarey

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

  1. No season at all: mock query returns null; assert findActive returns
    null (or throws NotFoundException — verify the current implementation
    and match it).

  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions