MCPcopy
hub / github.com/dosco/graphjin / TestCodeSQLRelativePathResolvesFromConfigPath

Function TestCodeSQLRelativePathResolvesFromConfigPath

serv/codesql_test.go:64–101  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

62}
63
64func TestCodeSQLRelativePathResolvesFromConfigPath(t *testing.T) {
65 configRoot := t.TempDir()
66 source := filepath.Join(configRoot, "app")
67 if err := os.MkdirAll(source, 0o755); err != nil {
68 t.Fatal(err)
69 }
70 writeTestFile(t, filepath.Join(source, "main.go"), `package main
71
72func Handler() {}
73`)
74
75 conf := &Config{
76 Core: Core{
77 Sources: []core.SourceConfig{
78 {Name: "code", Kind: "code", Path: "app"},
79 },
80 },
81 Serv: Serv{
82 ConfigPath: configRoot,
83 MCP: MCPConfig{Disable: true},
84 },
85 }
86
87 s, err := newGraphJinService(conf, nil)
88 if err != nil {
89 t.Fatal(err)
90 }
91 defer closeTestService(s)
92
93 var root string
94 err = s.managedDBs["code"].handle.DB.QueryRow(`SELECT root FROM code_index_status LIMIT 1`).Scan(&root)
95 if err != nil {
96 t.Fatal(err)
97 }
98 if root != source {
99 t.Fatalf("codesql root = %q, want %q", root, source)
100 }
101}
102
103func TestCodeSQLProductionDisablesLiveWatcherByDefault(t *testing.T) {
104 source := t.TempDir()

Callers

nothing calls this directly

Calls 4

writeTestFileFunction · 0.85
newGraphJinServiceFunction · 0.85
closeTestServiceFunction · 0.85
ScanMethod · 0.65

Tested by

no test coverage detected