mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-09-10 15:39:25 +00:00
test for test processor
This commit is contained in:
@@ -53,3 +53,20 @@ func TestProcessorBadRegistrationExistingType(t *testing.T) {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestTestProcessor(t *testing.T) {
|
||||||
|
testProcessor := &test.TestProcessor{
|
||||||
|
Config: config.ProcessorConfig{
|
||||||
|
Id: "test-id",
|
||||||
|
Type: "test",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
if testProcessor.Id() != "test-id" {
|
||||||
|
t.Fatalf("test processor has wrong id: %s", testProcessor.Id())
|
||||||
|
}
|
||||||
|
|
||||||
|
if testProcessor.Type() != "test" {
|
||||||
|
t.Fatalf("test processor has wrong type: %s", testProcessor.Type())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,17 +4,19 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/jwetzell/showbridge-go/internal/common"
|
"github.com/jwetzell/showbridge-go/internal/common"
|
||||||
|
"github.com/jwetzell/showbridge-go/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
type TestProcessor struct {
|
type TestProcessor struct {
|
||||||
|
Config config.ProcessorConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *TestProcessor) Id() string {
|
func (p *TestProcessor) Id() string {
|
||||||
return "test-id"
|
return p.Config.Id
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *TestProcessor) Type() string {
|
func (p *TestProcessor) Type() string {
|
||||||
return "test"
|
return p.Config.Type
|
||||||
}
|
}
|
||||||
func (p *TestProcessor) Process(ctx context.Context, wrappedPayload common.WrappedPayload) (common.WrappedPayload, error) {
|
func (p *TestProcessor) Process(ctx context.Context, wrappedPayload common.WrappedPayload) (common.WrappedPayload, error) {
|
||||||
return wrappedPayload, nil
|
return wrappedPayload, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user