github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/pkg/depends/kit/sqlx/builder/builder_z_function_test.go (about)

     1  package builder_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/onsi/gomega"
     7  
     8  	"github.com/machinefi/w3bstream/pkg/depends/kit/sqlx/builder"
     9  	"github.com/machinefi/w3bstream/pkg/depends/testutil/buildertestutil"
    10  )
    11  
    12  func TestFunc(t *testing.T) {
    13  	t.Run("Invalid", func(t *testing.T) {
    14  		gomega.NewWithT(t).Expect(builder.Func("")).To(buildertestutil.BeExpr(""))
    15  	})
    16  	t.Run("Count", func(t *testing.T) {
    17  		gomega.NewWithT(t).Expect(builder.Count()).To(buildertestutil.BeExpr("COUNT(1)"))
    18  	})
    19  	t.Run("Avg", func(t *testing.T) {
    20  		gomega.NewWithT(t).Expect(builder.Avg()).To(buildertestutil.BeExpr("AVG(*)"))
    21  	})
    22  }