MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestComposability

Function TestComposability

pkg/transform/orderby_test.go:77–93  ·  view source on GitHub ↗

Test composability: chain multiple transforms

(t *testing.T)

Source from the content-addressed store, hash-verified

75
76// Test composability: chain multiple transforms
77func TestComposability(t *testing.T) {
78 stmt := mustParse(t, "SELECT * FROM users")
79 err := Apply(stmt,
80 AddWhereFromSQL("active = true"),
81 SetLimit(10),
82 SetOffset(20),
83 AddOrderBy("created_at", true),
84 )
85 if err != nil {
86 t.Fatal(err)
87 }
88 out := format(stmt)
89 assertContains(t, out, "WHERE")
90 assertContains(t, out, "LIMIT")
91 assertContains(t, out, "OFFSET")
92 assertContains(t, out, "ORDER BY")
93}

Callers

nothing calls this directly

Calls 8

mustParseFunction · 0.85
ApplyFunction · 0.85
AddWhereFromSQLFunction · 0.85
SetLimitFunction · 0.85
SetOffsetFunction · 0.85
AddOrderByFunction · 0.85
assertContainsFunction · 0.85
formatFunction · 0.70

Tested by

no test coverage detected