The core protocol of WoopChain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
woop/api/service/manager_test.go

37 lines
761 B

package service
import (
"fmt"
"testing"
"time"
)
type SupportSyncingTest struct{}
func (s *SupportSyncingTest) StartService() {
fmt.Println("SupportSyncingTest starting")
}
func (s *SupportSyncingTest) StopService() {
fmt.Println("SupportSyncingTest stopping")
}
func (s *SupportSyncingTest) NotifyService(data map[string]interface{}) {
fmt.Println("SupportSyncingTest being notified")
}
// Test TakeAction.
func TestTakeAction(t *testing.T) {
m := &Manager{}
m.SetupServiceManager()
m.RegisterService(SupportSyncing, &SupportSyncingTest{})
for i := 0; i < 2; i++ {
select {
case <-time.After(100 * time.Millisecond):
m.SendAction(&Action{Action: Start, ServiceType: SupportSyncing})
}
}
m.SendAction(&Action{ServiceType: Done})
}