mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-23 20:35:24 +01:00
34 lines
680 B
Go
34 lines
680 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\":\"\",\"values\":null}" {
|
|
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\":\"\",\"values\":null}" {
|
|
t.Fail()
|
|
}
|
|
}
|