MCPcopy
hub / github.com/pocketbase/pocketbase / TestGeoPointFieldValidateValue

Function TestGeoPointFieldValidateValue

core/field_geo_point_test.go:73–197  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

71}
72
73func TestGeoPointFieldValidateValue(t *testing.T) {
74 app, _ := tests.NewTestApp()
75 defer app.Cleanup()
76
77 collection := core.NewBaseCollection("test_collection")
78
79 scenarios := []struct {
80 name string
81 field *core.GeoPointField
82 record func() *core.Record
83 expectError bool
84 }{
85 {
86 "invalid raw value",
87 &core.GeoPointField{Name: "test"},
88 func() *core.Record {
89 record := core.NewRecord(collection)
90 record.SetRaw("test", 123)
91 return record
92 },
93 true,
94 },
95 {
96 "zero field value (non-required)",
97 &core.GeoPointField{Name: "test"},
98 func() *core.Record {
99 record := core.NewRecord(collection)
100 record.SetRaw("test", types.GeoPoint{})
101 return record
102 },
103 false,
104 },
105 {
106 "zero field value (required)",
107 &core.GeoPointField{Name: "test", Required: true},
108 func() *core.Record {
109 record := core.NewRecord(collection)
110 record.SetRaw("test", types.GeoPoint{})
111 return record
112 },
113 true,
114 },
115 {
116 "non-zero Lat field value (required)",
117 &core.GeoPointField{Name: "test", Required: true},
118 func() *core.Record {
119 record := core.NewRecord(collection)
120 record.SetRaw("test", types.GeoPoint{Lat: 1})
121 return record
122 },
123 false,
124 },
125 {
126 "non-zero Lon field value (required)",
127 &core.GeoPointField{Name: "test", Required: true},
128 func() *core.Record {
129 record := core.NewRecord(collection)
130 record.SetRaw("test", types.GeoPoint{Lon: 1})

Callers

nothing calls this directly

Calls 7

CleanupMethod · 0.95
SetRawMethod · 0.95
NewTestAppFunction · 0.92
NewBaseCollectionFunction · 0.92
NewRecordFunction · 0.92
ValidateValueMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…