mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-12-12 03:01:06 +01:00
98d12ac489
Some checks are pending
Dev / build-local (push) Waiting to run
Dev / migrate-boltdb (push) Blocked by required conditions
Dev / migrate-mysql (push) Blocked by required conditions
Dev / migrate-mariadb (push) Blocked by required conditions
Dev / migrate-postgres (push) Blocked by required conditions
Dev / integrate-boltdb (push) Blocked by required conditions
Dev / integrate-mysql (push) Blocked by required conditions
Dev / integrate-mariadb (push) Blocked by required conditions
Dev / integrate-postgres (push) Blocked by required conditions
Dev / deploy-server (push) Blocked by required conditions
Dev / deploy-runner (push) Blocked by required conditions
34 lines
723 B
Go
34 lines
723 B
Go
package db
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestObjectToJSON(t *testing.T) {
|
|
v := &SurveyVar{
|
|
Name: "test",
|
|
Title: "Test",
|
|
}
|
|
s := ObjectToJSON(v)
|
|
assert.NotNil(t, s)
|
|
assert.Equal(t, "{\"name\":\"test\",\"title\":\"Test\",\"required\":false,\"type\":\"\",\"description\":\"\",\"values\":null}", *s)
|
|
}
|
|
|
|
func TestObjectToJSON2(t *testing.T) {
|
|
var v *SurveyVar = nil
|
|
s := ObjectToJSON(v)
|
|
assert.Nil(t, s)
|
|
}
|
|
|
|
func TestObjectToJSON3(t *testing.T) {
|
|
v := SurveyVar{
|
|
Name: "test",
|
|
Title: "Test",
|
|
}
|
|
s := ObjectToJSON(v)
|
|
assert.NotNil(t, s)
|
|
assert.Equal(t, "{\"name\":\"test\",\"title\":\"Test\",\"required\":false,\"type\":\"\",\"description\":\"\",\"values\":null}", *s)
|
|
}
|