MCPcopy
hub / github.com/pocketbase/pocketbase / TestFieldsListGetById

Function TestFieldsListGetById

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

Source from the content-addressed store, hash-verified

103}
104
105func TestFieldsListGetById(t *testing.T) {
106 f1 := &core.TextField{Id: "id1", Name: "test1"}
107 f2 := &core.EmailField{Id: "id2", Name: "test2"}
108 testFieldsList := core.NewFieldsList(f1, f2)
109
110 // missing field id
111 result1 := testFieldsList.GetById("test1")
112 if result1 != nil {
113 t.Fatalf("Found unexpected field %v", result1)
114 }
115
116 // existing field id
117 result2 := testFieldsList.GetById("id2")
118 if result2 == nil || result2.GetId() != "id2" {
119 t.Fatalf("Cannot find field with id %q, got %v ", "id2", result2)
120 }
121}
122
123func TestFieldsListGetByName(t *testing.T) {
124 f1 := &core.TextField{Id: "id1", Name: "test1"}

Callers

nothing calls this directly

Calls 3

GetByIdMethod · 0.95
NewFieldsListFunction · 0.92
GetIdMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…