MCPcopy
hub / github.com/pocketbase/pocketbase / TestNew

Function TestNew

pocketbase_test.go:11–50  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestNew(t *testing.T) {
12 // copy os.Args
13 originalArgs := make([]string, len(os.Args))
14 copy(originalArgs, os.Args)
15 defer func() {
16 // restore os.Args
17 os.Args = originalArgs
18 }()
19
20 // change os.Args
21 os.Args = os.Args[:1]
22 os.Args = append(
23 os.Args,
24 "--dir=test_dir",
25 "--encryptionEnv=test_encryption_env",
26 "--debug=true",
27 )
28
29 app := New()
30
31 if app == nil {
32 t.Fatal("Expected initialized PocketBase instance, got nil")
33 }
34
35 if app.RootCmd == nil {
36 t.Fatal("Expected RootCmd to be initialized, got nil")
37 }
38
39 if app.App == nil {
40 t.Fatal("Expected App to be initialized, got nil")
41 }
42
43 if app.DataDir() != "test_dir" {
44 t.Fatalf("Expected app.DataDir() %q, got %q", "test_dir", app.DataDir())
45 }
46
47 if app.EncryptionEnv() != "test_encryption_env" {
48 t.Fatalf("Expected app.EncryptionEnv() test_encryption_env, got %q", app.EncryptionEnv())
49 }
50}
51
52func TestNewWithConfig(t *testing.T) {
53 app := NewWithConfig(Config{

Callers

nothing calls this directly

Calls 4

copyFunction · 0.85
NewFunction · 0.70
DataDirMethod · 0.65
EncryptionEnvMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…