MCPcopy
hub / github.com/pocketbase/pocketbase / TestNewFieldsList

Function TestNewFieldsList

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

Source from the content-addressed store, hash-verified

12)
13
14func TestNewFieldsList(t *testing.T) {
15 fields := core.NewFieldsList(
16 &core.TextField{Id: "id1", Name: "test1"},
17 &core.TextField{Name: "test2"},
18 &core.TextField{Id: "id1", Name: "test1_new"}, // should replace the original id1 field
19 )
20
21 if len(fields) != 2 {
22 t.Fatalf("Expected 2 fields, got %d (%v)", len(fields), fields)
23 }
24
25 for _, f := range fields {
26 if f.GetId() == "" {
27 t.Fatalf("Expected field id to be set, found empty id for field %v", f)
28 }
29 }
30
31 if fields[0].GetName() != "test1_new" {
32 t.Fatalf("Expected field with name test1_new, got %s", fields[0].GetName())
33 }
34
35 if fields[1].GetName() != "test2" {
36 t.Fatalf("Expected field with name test2, got %s", fields[1].GetName())
37 }
38}
39
40func TestFieldsListClone(t *testing.T) {
41 f1 := &core.TextField{Name: "test1"}

Callers

nothing calls this directly

Calls 3

NewFieldsListFunction · 0.92
GetIdMethod · 0.65
GetNameMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…