Skip to content

Implement the User block #4

Description

@alupcosta

Context

Implement the User block of the domain layer: Voter and Administrator, plus two context-specific administrator subclasses that store data relevant to vote weighting.

Tasks and Requirements

  • Implement Voter: id and name, validated on creation.
  • Implement Administrator (base):
    • Register voters (registerVoter), preventing duplicate ids.
    • Control voting session state (authorizeVotingOpening, authorizeVotingClosing, isVotingOpen).
  • Implement CondominiumAdministrator (extends Administrator):
    • registerCondoMember(voter, idealFraction), storing each voter's ideal fraction.
  • Implement OnuAdministrator (extends Administrator):
    • registerMemberState(voter, isPermanent), storing permanent member status.

Automated Tests (Vitest)

The test suite must cover the following scenarios:

  • Valid creation of Voter and Administrator, plus error cases (missing id, empty name).
  • Duplicate voter registration is rejected.
  • Voting open/close state transitions, including invalid transitions (opening twice, closing when not open).
  • CondominiumAdministrator correctly stores and retrieves each voter's ideal fraction.
  • OnuAdministrator correctly stores and retrieves each voter's permanent member status.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Atividade2Issues da Atividade 2

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions