Semaphore/db/Store_test.go

34 lines
680 B
Go
Raw 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)
2024-05-20 14:07:28 +02:00
if s == nil || *s != "{\"name\":\"test\",\"title\":\"Test\",\"required\":false,\"type\":\"\",\"description\":\"\",\"values\":null}" {
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)
2024-05-20 12:38:29 +02:00
if s == nil || *s != "{\"name\":\"test\",\"title\":\"Test\",\"required\":false,\"type\":\"\",\"description\":\"\",\"values\":null}" {
2022-01-19 13:05:48 +01:00
t.Fail()
}
}