machine/model_test.go

30 lines
580 B
Go
Raw Permalink Normal View History

2024-04-04 17:33:22 +00:00
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
2024-04-04 20:08:50 +00:00
2024-04-04 17:33:22 +00:00
package machine
import (
2024-04-04 20:08:50 +00:00
"testing"
2024-04-04 17:33:22 +00:00
)
func setupModel(initial State) Modeler {
2024-04-04 20:08:50 +00:00
return NewModel(initial)
2024-04-04 17:33:22 +00:00
}
func TestMachineModel(t *testing.T) {
2024-04-04 20:08:50 +00:00
m := setupModel("")
if m == nil {
t.Errorf("Failed creating new model")
}
2024-04-04 17:33:22 +00:00
}
func TestMachineModelChangeState(t *testing.T) {
2024-04-04 20:08:50 +00:00
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")
}
2024-04-04 17:33:22 +00:00
}