package scopes import ( "os" tbase "testing" lib "git.sr.ht/~cco/go-scopes" "git.sr.ht/~cco/go-scopes/common/testing" "git.sr.ht/~cco/go-scopes/core/message" "git.sr.ht/~cco/go-scopes/tests/etc" ) func TestMatrixApp(tb *tbase.T) { logfile := "log/matrix.log" os.Remove(logfile) // make sure we start with a fresh log file t := testing.SetUpApp(tb, etc.ConfigMx()) t.Run("app-matrix", MxTest) t.TearDownApp("matrix") t.AssertEqual(t.LogCheck(logfile, true), 7) } func MxTest(t *testing.T) { ctx := t.Ctx t.AssertEqual(len(ctx.Services()), 3) c0 := ctx.Services()["cell-0"] rcvr := ctx.Services()["test-receiver"] msg := message.New("matrix", "create").WithSender(rcvr) c0.Send(msg) } // action handlers func MxReceiver(act lib.Action) bool { t := testing.GetT(act.Context()) t.AssertEqual(act.Message().Action(), "demo") return true } func init() { etc.AH_MxReceiver = MxReceiver }