Background
PredictionsService.submit (src/predictions/predictions.service.ts) validates
the market state (closed, cancelled, expired) before calling
this.sorobanService.submitPrediction. If the Soroban call is reached on an
invalid market, real XLM gets locked on-chain without a corresponding DB row.
There are currently no unit tests confirming the short-circuit behavior — only
the happy path is covered.
Goal
Add unit tests in src/predictions/predictions.service.spec.ts confirming that
SorobanService.submitPrediction is never called when market validation
fails.
Requirements
Create a predictions.service.spec.ts (or extend existing) with the following
cases. Use jest.spyOn(sorobanService, 'submitPrediction') to assert it is not
called.
- Market not found:
marketsRepository.findOne returns null →...
Background
PredictionsService.submit(src/predictions/predictions.service.ts) validatesthe market state (closed, cancelled, expired) before calling
this.sorobanService.submitPrediction. If the Soroban call is reached on aninvalid market, real XLM gets locked on-chain without a corresponding DB row.
There are currently no unit tests confirming the short-circuit behavior — only
the happy path is covered.
Goal
Add unit tests in
src/predictions/predictions.service.spec.tsconfirming thatSorobanService.submitPredictionis never called when market validationfails.
Requirements
Create a
predictions.service.spec.ts(or extend existing) with the followingcases. Use
jest.spyOn(sorobanService, 'submitPrediction')to assert it is notcalled.
marketsRepository.findOnereturnsnull→...