mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-10-13 03:37:12 +02:00
feat: add CountEntries to skip decryption for list --detail (#562)
* feat: add CountEntries to skip decryption for list --detail (#549) * test: add CountEntries and countCategory tests at browser level * fix: address review feedback on CountRows and countLocalStorage * test: add CountRows unit tests
This commit is contained in:
1 parent
5f42d4fe5f
commit
b3bbc0dadf
40 files changed
+1009
-101
No files matched your search
@@ -7,8 +7,9 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestExtractBookmarks(t *testing.T) {
|
||||
path := createTestJSON(t, "Bookmarks", `{
|
||||
func setupBookmarkJSON(t *testing.T) string {
|
||||
t.Helper()
|
||||
return createTestJSON(t, "Bookmarks", `{
|
||||
"roots": {
|
||||
"bookmark_bar": {
|
||||
"name": "Bookmarks Bar",
|
||||
@@ -33,6 +34,10 @@ func TestExtractBookmarks(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}`)
|
||||
}
|
||||
|
||||
func TestExtractBookmarks(t *testing.T) {
|
||||
path := setupBookmarkJSON(t)
|
||||
|
||||
got, err := extractBookmarks(path)
|
||||
require.NoError(t, err)
|
||||
@@ -52,6 +57,22 @@ func TestExtractBookmarks(t *testing.T) {
|
||||
assert.Equal(t, "News", got[2].Folder) // parent folder name
|
||||
}
|
||||
|
||||
func TestCountBookmarks(t *testing.T) {
|
||||
path := setupBookmarkJSON(t)
|
||||
|
||||
count, err := countBookmarks(path)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 3, count) // 3 URLs, folders not counted
|
||||
}
|
||||
|
||||
func TestCountBookmarks_Empty(t *testing.T) {
|
||||
path := createTestJSON(t, "Bookmarks", `{"roots": {}}`)
|
||||
|
||||
count, err := countBookmarks(path)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 0, count)
|
||||
}
|
||||
|
||||
func TestExtractBookmarks_FoldersExcluded(t *testing.T) {
|
||||
path := createTestJSON(t, "Bookmarks", `{
|
||||
"roots": {
|
||||
|
||||
Reference in new issue
Block a user