Semaphore/db/Store_test.go

34 lines
648 B
Go
Raw Permalink Normal View History

2022-01-19 13:05:48 +01:00
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\":\"\"}" {
2022-01-19 13:05:48 +01:00
t.Fail()
}
}
func TestObjectToJSON2(t *testing.T) {
2022-01-19 13:48:16 +01:00
var v *SurveyVar = nil
2022-01-19 13:05:48 +01:00
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\":\"\"}" {
2022-01-19 13:05:48 +01:00
t.Fail()
}
}