package handlers import ( "testing" "bookhoard/internal/utils" "github.com/jackc/pgx/v5/pgtype" "github.com/stretchr/testify/assert" ) func TestTextToString(t *testing.T) { tests := []struct { name string input pgtype.Text expected string }{ {"valid text", pgtype.Text{String: "hello", Valid: true}, "hello"}, {"null text", pgtype.Text{Valid: false}, ""}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { result := utils.PgTextString(tt.input) assert.Equal(t, tt.expected, result) }) } }