Semaphore/db/Store_test.go
2022-01-19 17:53:58 +05:00

34 lines
648 B
Go

package db
import "testing"
func TestObjectToJSON(t *testing.T) {
v := &SurveyVar{
Name: "test",
Title: "Test",
}
s := ObjectToJSON(v)
if s == nil || *s != "{\"name\":\"test\",\"title\":\"Test\",\"required\":false,\"type\":\"\",\"description\":\"\"}" {
t.Fail()
}
}
func TestObjectToJSON2(t *testing.T) {
var v *SurveyVar = nil
s := ObjectToJSON(v)
if s != nil {
t.Fail()
}
}
func TestObjectToJSON3(t *testing.T) {
v := SurveyVar{
Name: "test",
Title: "Test",
}
s := ObjectToJSON(v)
if s == nil || *s != "{\"name\":\"test\",\"title\":\"Test\",\"required\":false,\"type\":\"\",\"description\":\"\"}" {
t.Fail()
}
}