Skip to content

[Enhancement]: Missing negative and boundary test coverage for Election lifecycle functions #226

@harshkumarrai

Description

@harshkumarrai

Is there an existing issue for this?

  • I have searched the existing issues

Issue Description ✍️

📌 Issue Summary

📌 Problem
The Election lifecycle contracts currently focus on happy-path tests. Several
invalid or boundary scenarios are either not tested or not explicitly asserted
with revert reasons.

This creates risk of silent regressions when modifying election logic.

Examples of missing or weak coverage:
• Calling lifecycle functions before election start
• Calling lifecycle functions after election end
• Invalid timestamps or durations during election creation
• Repeated or duplicate lifecycle actions
• Boundary conditions around start/end blocks

🎯 Proposal
Add explicit negative and boundary-condition tests to ensure:
• Correct reverts with expected error selectors
• Lifecycle invariants are enforced consistently
• Future refactors cannot accidentally relax constraints

🛠️ Scope
• Tests only (no contract logic changes unless a missing revert is discovered)
• Focus on Election / ElectionFactory lifecycle functions
• Use existing Hardhat setup (or Foundry if preferred and acceptable)

I’d like to work on this issue and submit a PR with focused test additions.

Record

  • I have synced all my node versions as mentioned in the project
  • I am using the same version of npm as is the project
  • My current branch is in sync with the development branch
  • I want to work on this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions