machine/model_test.go
Matthew Rich a4942d95a1
Some checks failed
Machine Tests / test (push) Waiting to run
Lint / golangci-lint (push) Has been cancelled
fix module path
2024-04-04 11:52:39 -07:00

30 lines
598 B
Go

// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
package machine
import (
"testing"
)
func setupModel(initial State) Modeler {
return NewModel(initial)
}
func TestMachineModel(t *testing.T) {
m := setupModel("")
if m == nil {
t.Errorf("Failed creating new model")
}
}
func TestMachineModelChangeState(t *testing.T) {
m := setupModel("")
oldState := m.ChangeState("connected")
if oldState != "" {
t.Errorf("Failed changing state in model")
}
if m.InspectState() != "connected" {
t.Errorf("Failed changing state in model")
}
}