Background
DisputesService.create checks for an existing dispute with
status: DisputeStatus.PENDING. If a previous dispute was resolved (status
changed to RESOLVED or REJECTED), a second dispute can be raised for the
same market. It's unclear if this is intentional. There are no tests for this
scenario.
Goal
Add tests clarifying the intended behavior and guard it.
Requirements
-
Determine the intended behavior by checking business rules: can a market
receive only one dispute ever, or one active dispute at a time?
- If one per market ever: change the check to
where: { marketId } (no
status filter).
- If one active at a time: the current check is correct.
-
Regardless of the decision, add tests in
Acceptance criteria
- Policy is documented and tested.
- No silent second-dispute creation that contradicts the policy.
Background
DisputesService.createchecks for an existing dispute withstatus: DisputeStatus.PENDING. If a previous dispute was resolved (statuschanged to
RESOLVEDorREJECTED), a second dispute can be raised for thesame market. It's unclear if this is intentional. There are no tests for this
scenario.
Goal
Add tests clarifying the intended behavior and guard it.
Requirements
Determine the intended behavior by checking business rules: can a market
receive only one dispute ever, or one active dispute at a time?
where: { marketId }(nostatus filter).
Regardless of the decision, add tests in
Acceptance criteria