Skip to content

reinno/protoactor-go-testkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TestKit for ProtoActor-Go

Provide a AKKA TestKit like for Protoactor.

Build Status Go Report Card

Example

package testkit

import (
	"testing"

	"github.com/AsynkronIT/protoactor-go/actor"
	"github.com/stretchr/testify/assert"
)

func helloActorProps() *actor.Props {
	return actor.FromFunc(func(context actor.Context) {
		switch context.Message() {
		case hello:
			context.Respond("world")
		}
	})
}

func TestTestProbeReceiveMsg(t *testing.T) {
	helloActor := actor.Spawn(helloActorProps())
	tp := NewTestProbe(t)

	tp.Request(helloActor, "hello")
	tp.ExpectMsg("world")
	tp.ExpectNoMsg()

	tp.StopGraceful()
}

Releases

No releases published

Packages

No packages published

Languages