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

Function TestHandleFormatSQL_UppercaseKeywords

pkg/mcp/tools_test.go:660–682  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

658}
659
660func TestHandleFormatSQL_UppercaseKeywords(t *testing.T) {
661 ctx := context.Background()
662 req := makeReq(map[string]any{
663 "sql": "select id from users where active = true",
664 "uppercase_keywords": true,
665 })
666 res, err := handleFormatSQL(ctx, req)
667 if err != nil {
668 t.Fatalf("unexpected error: %v", err)
669 }
670 data := unmarshalResult(t, res)
671 formatted, ok := data["formatted_sql"].(string)
672 if !ok || formatted == "" {
673 t.Fatal("expected non-empty formatted_sql")
674 }
675 opts, ok := data["options"].(map[string]any)
676 if !ok {
677 t.Fatal("expected 'options' map in result")
678 }
679 if opts["uppercase_keywords"] != true {
680 t.Errorf("expected uppercase_keywords=true in options, got %v", opts["uppercase_keywords"])
681 }
682}
683
684func TestHandleFormatSQL_InvalidSQL(t *testing.T) {
685 ctx := context.Background()

Callers

nothing calls this directly

Calls 5

makeReqFunction · 0.85
handleFormatSQLFunction · 0.85
unmarshalResultFunction · 0.85
FatalfMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected