Skip to content

Commit

Permalink
Add a dummy recorder for testing purposes
Browse files Browse the repository at this point in the history
  • Loading branch information
ccremer committed Aug 14, 2022
1 parent 7076b17 commit 145e3b2
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions pipelinetest/dummyrecorder.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package pipelinetest

import (
"context"

pipeline "github.com/ccremer/go-command-pipeline"
)

// NewNoResolver returns a pipeline.DependencyResolver that doesn't actually resolve anything.
// This can be used for testing.
func NewNoResolver[T context.Context]() pipeline.DependencyResolver[T] {
return &NoResolver[T]{}
}

// NoResolver is a pipeline.DependencyResolver that doesn't actually resolve anything.
// This can be used for testing.
type NoResolver[T context.Context] struct{}

func (d NoResolver[T]) Record(_ pipeline.Step[T]) {
// noop
}

func (d NoResolver[T]) RequireDependencyByStepName(_ ...string) error {
// noop
return nil
}

func (d NoResolver[T]) MustRequireDependencyByStepName(_ ...string) {
// noop
}

func (d NoResolver[T]) RequireDependencyByFuncName(_ ...pipeline.ActionFunc[T]) error {
// noop
return nil
}

func (d NoResolver[T]) MustRequireDependencyByFuncName(_ ...pipeline.ActionFunc[T]) {
// noop
}

0 comments on commit 145e3b2

Please sign in to comment.