@@ -28,9 +28,12 @@ func TestInitCreatesPrivateDirsAndDoctorJSON(t *testing.T) {
2828 t .Fatalf ("init failed: code=%d err=%s" , code , errb .String ())
2929 }
3030 paths := ResolvePaths ()
31- assertPrivate (t , filepath .Dir (paths .ConfigPath ))
31+ if _ , err := os .Stat (paths .ConfigPath ); ! errors .Is (err , os .ErrNotExist ) {
32+ t .Fatalf ("init created config.toml at %s: %v" , paths .ConfigPath , err )
33+ }
3234 assertPrivate (t , paths .DataDir )
3335 assertPrivate (t , paths .CacheDir )
36+ assertPrivate (t , paths .DBPath )
3437
3538 out .Reset ()
3639 errb .Reset ()
@@ -46,6 +49,23 @@ func TestInitCreatesPrivateDirsAndDoctorJSON(t *testing.T) {
4649 }
4750}
4851
52+ func TestInitLeavesExistingConfigUntouched (t * testing.T ) {
53+ withTempHome (t )
54+ paths := ResolvePaths ()
55+ custom := "db_path = \" /custom/fork.db\" \n cache_dir = \" /custom/cache\" \n "
56+ mustWrite (t , paths .ConfigPath , custom )
57+
58+ runOK (t , "init" )
59+
60+ got , err := os .ReadFile (paths .ConfigPath )
61+ if err != nil {
62+ t .Fatalf ("read config: %v" , err )
63+ }
64+ if string (got ) != custom {
65+ t .Fatalf ("init rewrote config.toml:\n got %q\n want %q" , got , custom )
66+ }
67+ }
68+
4969func TestDoctorMCPJSON (t * testing.T ) {
5070 withTempHome (t )
5171 runOK (t , "init" )
0 commit comments