machine/model_test.go

30 lines
598 B
Go
Raw Normal View History

2024-04-04 17:33:22 +00:00
// 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")
}
}