mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-24 22:06:43 +01:00
34 lines
648 B
Go
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()
|
|
}
|
|
}
|