Skip to content

[Backend] — Test: SeasonsService.create rejects overlapping active seasons #1149

Description

@Olowodarey

Background

SeasonsService.create (src/seasons/seasons.service.ts) should prevent
creating two seasons with overlapping [starts_at, ends_at] windows. If both
were active simultaneously, leaderboard points would accrue to two seasons at
once. There are no tests verifying this overlap check.

Goal

Add overlap-rejection tests in src/seasons/seasons.service.spec.ts.

Requirements

  1. Seed an active season [100, 200].
  2. Attempt to create:
    • [150, 250] (starts inside existing) → error.
    • [50, 150] (ends inside existing) → error.
    • [120, 180] (fully inside existing) → error.
    • [200, 300] (starts exactly at existing end) → success.
  3. Finalize the existing season; attempt [150, 250] again → success.

Acceptance criteria

  • Overlapping seasons are rejected.
  • Non-overlapping creation succeeds.

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