summaryrefslogtreecommitdiff
path: root/state_test.go
blob: 965ba6b68ae97c588ec97befd940e8f2d9b7572e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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())
}