mirror of
https://github.com/status-im/status-go.git
synced 2025-01-12 23:55:03 +00:00
735a422230
* chore_: create v2 endpoints for status.go to use status-backend server * feat_: support using http for media server (#6060)
29 lines
849 B
Go
29 lines
849 B
Go
package api
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestParseAppType(t *testing.T) {
|
|
check := func(input string, expectedState AppState, expectError bool) {
|
|
actualState, err := ParseAppState(input)
|
|
assert.Equalf(t, expectedState, actualState, "unexpected result from parseAppState")
|
|
if expectError {
|
|
assert.NotNil(t, err, "error should not be nil")
|
|
}
|
|
}
|
|
|
|
check("active", AppStateForeground, false)
|
|
check("background", AppStateBackground, false)
|
|
check("inactive", AppStateInactive, false)
|
|
check(" acTIVE ", AppStateForeground, false)
|
|
check(" backGROUND ", AppStateBackground, false)
|
|
check(" INACTIVE ", AppStateInactive, false)
|
|
check("", AppStateInvalid, true)
|
|
check("back ground", AppStateInvalid, true)
|
|
check(" back ground ", AppStateInvalid, true)
|
|
check(" ", AppStateInvalid, true)
|
|
}
|