0b8ac34aee
Pre-existing work-in-progress in the tree: karakeep, snippets, skills-health and redaction ingesters, the opencode.db session sweep, gossip and metrics changes. Checkpointed as-is so the adapter fix in the next commit stays reviewable on its own.
41 lines
1.0 KiB
Go
41 lines
1.0 KiB
Go
package ingest
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func touch(t *testing.T, path string) {
|
|
t.Helper()
|
|
if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := os.WriteFile(path, []byte("x"), 0o644); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestChromiumHistoryPaths(t *testing.T) {
|
|
home := t.TempDir()
|
|
touch(t, filepath.Join(home, ".config/net.imput.helium/Default/History"))
|
|
touch(t, filepath.Join(home, ".config/google-chrome/Profile 1/History"))
|
|
touch(t, filepath.Join(home, ".config/BraveSoftware/Brave-Browser/Default/History"))
|
|
|
|
got := chromiumHistoryPaths(home)
|
|
if len(got) != 3 {
|
|
t.Fatalf("got %d paths, want 3: %v", len(got), got)
|
|
}
|
|
}
|
|
|
|
func TestFirefoxPlacesPaths(t *testing.T) {
|
|
home := t.TempDir()
|
|
touch(t, filepath.Join(home, ".mozilla/firefox/wuuvr9ed.default-release/places.sqlite"))
|
|
touch(t, filepath.Join(home, "snap/firefox/common/.mozilla/firefox/abc.default/places.sqlite"))
|
|
|
|
got := firefoxPlacesPaths(home)
|
|
if len(got) != 2 {
|
|
t.Fatalf("got %d paths, want 2: %v", len(got), got)
|
|
}
|
|
}
|