MCPcopy
hub / github.com/pocketbase/pocketbase / TestHasTable

Function TestHasTable

core/db_table_test.go:17–43  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15)
16
17func TestHasTable(t *testing.T) {
18 t.Parallel()
19
20 app, _ := tests.NewTestApp()
21 defer app.Cleanup()
22
23 scenarios := []struct {
24 tableName string
25 expected bool
26 }{
27 {"", false},
28 {"test", false},
29 {core.CollectionNameSuperusers, true},
30 {"demo3", true},
31 {"DEMO3", true}, // table names are case insensitives by default
32 {"view1", true}, // view
33 }
34
35 for _, s := range scenarios {
36 t.Run(s.tableName, func(t *testing.T) {
37 result := app.HasTable(s.tableName)
38 if result != s.expected {
39 t.Fatalf("Expected %v, got %v", s.expected, result)
40 }
41 })
42 }
43}
44
45func TestAuxHasTable(t *testing.T) {
46 t.Parallel()

Callers

nothing calls this directly

Calls 4

CleanupMethod · 0.95
NewTestAppFunction · 0.92
HasTableMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…