MCPcopy
hub / github.com/pocketbase/pocketbase / TestDateFieldValidateSettings

Function TestDateFieldValidateSettings

core/field_date_test.go:133–230  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

131}
132
133func TestDateFieldValidateSettings(t *testing.T) {
134 testDefaultFieldIdValidation(t, core.FieldTypeDate)
135 testDefaultFieldNameValidation(t, core.FieldTypeDate)
136 testDefaultFieldHelpValidation[core.DateField](t)
137
138 app, _ := tests.NewTestApp()
139 defer app.Cleanup()
140
141 collection := core.NewBaseCollection("test_collection")
142
143 scenarios := []struct {
144 name string
145 field func() *core.DateField
146 expectErrors []string
147 }{
148 {
149 "zero Min/Max",
150 func() *core.DateField {
151 return &core.DateField{
152 Id: "test",
153 Name: "test",
154 }
155 },
156 []string{},
157 },
158 {
159 "non-empty Min with empty Max",
160 func() *core.DateField {
161 return &core.DateField{
162 Id: "test",
163 Name: "test",
164 Min: types.NowDateTime(),
165 }
166 },
167 []string{},
168 },
169 {
170 "empty Min non-empty Max",
171 func() *core.DateField {
172 return &core.DateField{
173 Id: "test",
174 Name: "test",
175 Max: types.NowDateTime(),
176 }
177 },
178 []string{},
179 },
180 {
181 "Min = Max",
182 func() *core.DateField {
183 date := types.NowDateTime()
184 return &core.DateField{
185 Id: "test",
186 Name: "test",
187 Min: date,
188 Max: date,
189 }
190 },

Callers

nothing calls this directly

Calls 10

CleanupMethod · 0.95
NewTestAppFunction · 0.92
NewBaseCollectionFunction · 0.92
NowDateTimeFunction · 0.92
TestValidationErrorsFunction · 0.92
ValidateSettingsMethod · 0.65
AddMethod · 0.45
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…