Semaphore/db/Store_test.go
Denis Gukov 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
test: use testify
2024-11-23 11:25:32 +00:00

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)
}