Skip to content

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
  • Loading branch information
Johnlon committed May 8, 2024
1 parent a945e9f commit de4d1d1
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,18 @@ func Attachments(ctx context.Context) []Attachment {

func pickleAttachments(ctx context.Context) []*models.PickleAttachment {

pickedAttachments := []*models.PickleAttachment{}
pickledAttachments := []*models.PickleAttachment{}
attachments := Attachments(ctx)

for _, a := range attachments {
pickedAttachments = append(pickedAttachments, &models.PickleAttachment{
pickledAttachments = append(pickledAttachments, &models.PickleAttachment{
Name: a.FileName,
Data: a.Body,
MimeType: a.MediaType,
})

Check warning on line 101 in suite.go

View check run for this annotation

Codecov / codecov/patch

suite.go#L97-L101

Added lines #L97 - L101 were not covered by tests
}

return pickedAttachments
return pickledAttachments
}

func (s *suite) matchStep(step *messages.PickleStep) *models.StepDefinition {
Expand Down Expand Up @@ -160,8 +160,7 @@ func (s *suite) runStep(ctx context.Context, pickle *Scenario, step *Step, scena
status = StepPassed
}

// JL
pickedAttachments := pickleAttachments(ctx)
pickledAttachments := pickleAttachments(ctx)
ctx = Attach(ctx)

// Run after step handlers.
Expand All @@ -180,19 +179,19 @@ func (s *suite) runStep(ctx context.Context, pickle *Scenario, step *Step, scena

switch {
case err == nil:
sr := models.NewStepResult(models.Passed, pickle.Id, step.Id, match, pickedAttachments, nil)
sr := models.NewStepResult(models.Passed, pickle.Id, step.Id, match, pickledAttachments, nil)
s.storage.MustInsertPickleStepResult(sr)
s.fmt.Passed(pickle, step, match.GetInternalStepDefinition())
case errors.Is(err, ErrPending):
sr := models.NewStepResult(models.Pending, pickle.Id, step.Id, match, pickedAttachments, nil)
sr := models.NewStepResult(models.Pending, pickle.Id, step.Id, match, pickledAttachments, nil)
s.storage.MustInsertPickleStepResult(sr)
s.fmt.Pending(pickle, step, match.GetInternalStepDefinition())
case errors.Is(err, ErrSkip):
sr := models.NewStepResult(models.Skipped, pickle.Id, step.Id, match, pickedAttachments, nil)
sr := models.NewStepResult(models.Skipped, pickle.Id, step.Id, match, pickledAttachments, nil)
s.storage.MustInsertPickleStepResult(sr)
s.fmt.Skipped(pickle, step, match.GetInternalStepDefinition())
default:
sr := models.NewStepResult(models.Failed, pickle.Id, step.Id, match, pickedAttachments, err)
sr := models.NewStepResult(models.Failed, pickle.Id, step.Id, match, pickledAttachments, err)
s.storage.MustInsertPickleStepResult(sr)
s.fmt.Failed(pickle, step, match.GetInternalStepDefinition(), err)
}
Expand All @@ -211,11 +210,10 @@ func (s *suite) runStep(ctx context.Context, pickle *Scenario, step *Step, scena
s.fmt.Defined(pickle, step, match.GetInternalStepDefinition())

if err != nil {

pickedAttachments := pickleAttachments(ctx)
pickledAttachments := pickleAttachments(ctx)
ctx = Attach(ctx)

sr := models.NewStepResult(models.Failed, pickle.Id, step.Id, match, pickedAttachments, nil)
sr := models.NewStepResult(models.Failed, pickle.Id, step.Id, match, pickledAttachments, nil)
s.storage.MustInsertPickleStepResult(sr)
return ctx, err
}
Expand All @@ -237,21 +235,21 @@ func (s *suite) runStep(ctx context.Context, pickle *Scenario, step *Step, scena
}
}

pickedAttachments := pickleAttachments(ctx)
pickledAttachments := pickleAttachments(ctx)
ctx = Attach(ctx)

sr := models.NewStepResult(models.Undefined, pickle.Id, step.Id, match, pickedAttachments, nil)
sr := models.NewStepResult(models.Undefined, pickle.Id, step.Id, match, pickledAttachments, nil)
s.storage.MustInsertPickleStepResult(sr)

s.fmt.Undefined(pickle, step, match.GetInternalStepDefinition())
return ctx, ErrUndefined
}

if scenarioErr != nil {
pickedAttachments := pickleAttachments(ctx)
pickledAttachments := pickleAttachments(ctx)
ctx = Attach(ctx)

sr := models.NewStepResult(models.Skipped, pickle.Id, step.Id, match, pickedAttachments, nil)
sr := models.NewStepResult(models.Skipped, pickle.Id, step.Id, match, pickledAttachments, nil)
s.storage.MustInsertPickleStepResult(sr)

s.fmt.Skipped(pickle, step, match.GetInternalStepDefinition())
Expand Down

0 comments on commit de4d1d1

Please sign in to comment.