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) } }