1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-09 17:44:59 +09:00
anytype-heart/app/testapp/testapp.go
Sergey Cherepanov c85280e8a5
fix tests
2021-03-16 10:24:35 +03:00

38 lines
623 B
Go

package testapp
import (
"github.com/anytypeio/go-anytype-middleware/app"
"github.com/anytypeio/go-anytype-middleware/core/event"
"github.com/anytypeio/go-anytype-middleware/pb"
)
func New() *TestApp {
return &TestApp{&app.App{}}
}
type TestApp struct {
*app.App
}
func (ta *TestApp) With(cmp app.Component) *TestApp {
ta.Register(cmp)
return ta
}
type EventSender struct {
F func(e *pb.Event)
}
func (e *EventSender) Init(a *app.App) (err error) {
return
}
func (e *EventSender) Name() (name string) {
return event.CName
}
func (e *EventSender) Send(event *pb.Event) {
if e.F != nil {
e.F(event)
}
}