MCPcopy
hub / github.com/pocketbase/pocketbase / TestFieldsListGetByName

Function TestFieldsListGetByName

core/fields_list_test.go:123–139  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

121}
122
123func TestFieldsListGetByName(t *testing.T) {
124 f1 := &core.TextField{Id: "id1", Name: "test1"}
125 f2 := &core.EmailField{Id: "id2", Name: "test2"}
126 testFieldsList := core.NewFieldsList(f1, f2)
127
128 // missing field name
129 result1 := testFieldsList.GetByName("id1")
130 if result1 != nil {
131 t.Fatalf("Found unexpected field %v", result1)
132 }
133
134 // existing field name
135 result2 := testFieldsList.GetByName("test2")
136 if result2 == nil || result2.GetName() != "test2" {
137 t.Fatalf("Cannot find field with name %q, got %v ", "test2", result2)
138 }
139}
140
141func TestFieldsListRemove(t *testing.T) {
142 testFieldsList := core.NewFieldsList(

Callers

nothing calls this directly

Calls 3

GetByNameMethod · 0.95
NewFieldsListFunction · 0.92
GetNameMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…