Skip to content

Commit

Permalink
chore: fix linter issue
Browse files Browse the repository at this point in the history
Signed-off-by: Elias Van Ootegem <[email protected]>
  • Loading branch information
EVODelavega committed Sep 5, 2024
1 parent 7653656 commit 0041905
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions core/integration/steps/the_loss_socialisation_amount_is.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ func TheLossSocialisationAmountsAre(broker *stubs.BrokerStub, table *godog.Table
if !ok {
return fmt.Errorf("no loss socialisation events found for market %s", lsr.Market())
}
parties := map[string]struct{}{}
parties := map[string]types.LossType{}
for _, e := range mevts {
if lsr.Amount().EQ(e.Amount()) {
parties[e.PartyID()] = struct{}{}
parties[e.PartyID()] = e.LossType()
}
}
if c := lsr.Count(); c != -1 {
Expand All @@ -47,9 +47,13 @@ func TheLossSocialisationAmountsAre(broker *stubs.BrokerStub, table *godog.Table
}
}
for _, p := range lsr.Party() {
if _, ok := parties[p]; !ok {
lt, ok := parties[p]
if !ok {
return fmt.Errorf("no loss socialisation found for party %s on market %s for amount %s (type: %s)", p, lsr.Market(), lsr.Amount().String(), lsr.Type().String())
}
if !lsr.matchesType(lt) {
return fmt.Errorf("loss socialisation for party %s on market %s for amount %s is of type %s, not %s", p, lsr.Market(), lsr.Amount().String(), lt.String(), lsr.Type().String())
}
}
}
return nil
Expand Down Expand Up @@ -124,8 +128,7 @@ func (l lossSocRow) Count() int {

func (l lossSocRow) matchesType(t types.LossType) bool {
if l.r.HasColumn("type") {
exp := l.Type()
return exp == t
return l.Type() == t
}
return true
}
Expand Down

0 comments on commit 0041905

Please sign in to comment.