Add tests for noop event stream

This commit is contained in:
9seconds
2021-03-16 11:38:29 +03:00
parent f0063ba089
commit e009d05a90
8 changed files with 160 additions and 13 deletions
+27
View File
@@ -0,0 +1,27 @@
package events
import (
"context"
"github.com/9seconds/mtg/v2/mtglib"
)
type noop struct{}
func (n noop) Send(ctx context.Context, evt mtglib.Event) {}
func (n noop) Shutdown() {}
func NewNoopStream() mtglib.EventStream {
return noop{}
}
type noopObserver struct{}
func (n noopObserver) EventStart(_ mtglib.EventStart) {}
func (n noopObserver) EventFinish(_ mtglib.EventFinish) {}
func (n noopObserver) EventConcurrencyLimited(_ mtglib.EventConcurrencyLimited) {}
func (n noopObserver) Shutdown() {}
func NewNoopObserver() Observer {
return noopObserver{}
}