From 06fd659215a4b7c4d1b7d2303aa7f6b477167801 Mon Sep 17 00:00:00 2001 From: Elias Van Ootegem Date: Tue, 3 Sep 2024 10:30:49 +0100 Subject: [PATCH] chore: fix linter issue Signed-off-by: Elias Van Ootegem --- .../steps/the_loss_socialisation_amount_is.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/core/integration/steps/the_loss_socialisation_amount_is.go b/core/integration/steps/the_loss_socialisation_amount_is.go index 724a74283a..e6fac78f07 100644 --- a/core/integration/steps/the_loss_socialisation_amount_is.go +++ b/core/integration/steps/the_loss_socialisation_amount_is.go @@ -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 { @@ -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 @@ -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 }