MCPcopy Index your code
hub / github.com/pocketbase/pocketbase / TestCreateViewFields

Function TestCreateViewFields

core/view_test.go:202–546  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

200}
201
202func TestCreateViewFields(t *testing.T) {
203 t.Parallel()
204
205 app, _ := tests.NewTestApp()
206 defer app.Cleanup()
207
208 scenarios := []struct {
209 name string
210 query string
211 expectError bool
212 expectFields map[string]string // name-type pairs
213 }{
214 {
215 "empty query",
216 "",
217 true,
218 nil,
219 },
220 {
221 "invalid query",
222 "test 123456",
223 true,
224 nil,
225 },
226 {
227 "missing table",
228 "select id from missing",
229 true,
230 nil,
231 },
232 {
233 "query with wildcard column",
234 "select a.id, a.* from demo1 a",
235 true,
236 nil,
237 },
238 {
239 "query without id",
240 "select text, url, created, updated from demo1",
241 true,
242 nil,
243 },
244 {
245 "query with comments",
246 `
247 select
248 -- test single line
249 demo1.id,
250 demo1.text,
251 /* multi
252 * line comment block */
253 demo1.url, demo1.created, demo1.updated from/* inline comment block with no spaces between the identifiers */demo1
254 -- comment before join
255 join demo2 ON (
256 -- comment inside join
257 demo2.id = demo1.id
258 )
259 -- comment before where

Callers

nothing calls this directly

Calls 7

CleanupMethod · 0.95
NewTestAppFunction · 0.92
ensureNoTempViewsFunction · 0.85
GetByNameMethod · 0.80
CreateViewFieldsMethod · 0.65
TypeMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…