diff options
Diffstat (limited to 'state_test.go')
-rw-r--r-- | state_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/state_test.go b/state_test.go new file mode 100644 index 00000000..965ba6b6 --- /dev/null +++ b/state_test.go @@ -0,0 +1,21 @@ +package roadrunner + +import ( + "github.com/stretchr/testify/assert" + "testing" +) + +func Test_NewState(t *testing.T) { + st := newState(StateErrored) + + assert.Equal(t, "errored", st.String()) + assert.NotEqual(t, 0, st.Updated().Unix()) +} + +func Test_IsActive(t *testing.T) { + assert.False(t, newState(StateInactive).IsActive()) + assert.True(t, newState(StateReady).IsActive()) + assert.True(t, newState(StateWorking).IsActive()) + assert.False(t, newState(StateStopped).IsActive()) + assert.False(t, newState(StateErrored).IsActive()) +} |