MCPcopy
hub / github.com/pocketbase/pocketbase / TestFieldsListFieldNames

Function TestFieldsListFieldNames

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

Source from the content-addressed store, hash-verified

63}
64
65func TestFieldsListFieldNames(t *testing.T) {
66 f1 := &core.TextField{Name: "test1"}
67 f2 := &core.EmailField{Name: "test2"}
68 testFieldsList := core.NewFieldsList(f1, f2)
69
70 result := testFieldsList.FieldNames()
71
72 expected := []string{f1.Name, f2.Name}
73
74 if len(result) != len(expected) {
75 t.Fatalf("Expected %d slice elements, got %d\n%v", len(expected), len(result), result)
76 }
77
78 for _, name := range expected {
79 if !slices.Contains(result, name) {
80 t.Fatalf("Missing name %q in %v", name, result)
81 }
82 }
83}
84
85func TestFieldsListAsMap(t *testing.T) {
86 f1 := &core.TextField{Name: "test1"}

Callers

nothing calls this directly

Calls 2

FieldNamesMethod · 0.95
NewFieldsListFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…