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

Function TestPlugin_RecordsTableName

integrations/gorm/plugin_test.go:67–87  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

65}
66
67func TestPlugin_RecordsTableName(t *testing.T) {
68 db := openTestDB(t)
69 plugin := gosqlxgorm.NewPlugin()
70 _ = db.Use(plugin)
71
72 var users []User
73 db.Where("name = ?", "alice").Find(&users)
74
75 stats := plugin.Stats()
76 found := false
77 for _, q := range stats.Queries {
78 for _, tbl := range q.Tables {
79 if tbl == "users" {
80 found = true
81 }
82 }
83 }
84 if !found {
85 t.Errorf("expected 'users' in recorded table names; got %+v", stats.Queries)
86 }
87}
88
89func TestPlugin_ParseErrorDoesNotPanic(t *testing.T) {
90 db := openTestDB(t)

Callers

nothing calls this directly

Calls 3

StatsMethod · 0.95
openTestDBFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected