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

Function TestPlugin_MaxHistory

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

Source from the content-addressed store, hash-verified

99}
100
101func TestPlugin_MaxHistory(t *testing.T) {
102 db := openTestDB(t)
103 plugin := gosqlxgorm.NewPluginWithOptions(gosqlxgorm.PluginOptions{
104 MaxHistory: 5,
105 })
106 _ = db.Use(plugin)
107
108 // Execute more queries than the limit.
109 for i := 0; i < 10; i++ {
110 var users []User
111 db.Find(&users)
112 }
113
114 stats := plugin.Stats()
115 if stats.TotalQueries > 5 {
116 t.Errorf("expected at most 5 queries, got %d", stats.TotalQueries)
117 }
118}
119
120func TestPlugin_OnParseError(t *testing.T) {
121 var called bool

Callers

nothing calls this directly

Calls 3

openTestDBFunction · 0.85
StatsMethod · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected