(t *testing.T)
| 62 | } |
| 63 | |
| 64 | func 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 | |
| 72 | func 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 | |
| 103 | func TestCodeSQLProductionDisablesLiveWatcherByDefault(t *testing.T) { |
| 104 | source := t.TempDir() |
nothing calls this directly
no test coverage detected