MCPcopy
hub / github.com/pocketbase/pocketbase / TestGet

Function TestGet

tools/store/store_test.go:130–150  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

128}
129
130func TestGet(t *testing.T) {
131 s := store.New(map[string]int{"test1": 0, "test2": 1})
132
133 scenarios := []struct {
134 key string
135 expect int
136 }{
137 {"test1", 0},
138 {"test2", 1},
139 {"missing", 0}, // should auto fallback to the zero value
140 }
141
142 for _, scenario := range scenarios {
143 t.Run(scenario.key, func(t *testing.T) {
144 val := s.Get(scenario.key)
145 if val != scenario.expect {
146 t.Fatalf("Expected %v, got %v", scenario.expect, val)
147 }
148 })
149 }
150}
151
152func TestGetOk(t *testing.T) {
153 s := store.New(map[string]int{"test1": 0, "test2": 1})

Callers

nothing calls this directly

Calls 3

NewFunction · 0.92
GetMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…