mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-06-06 19:53:53 +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:
@@ -7,8 +7,9 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestExtractExtensions(t *testing.T) {
|
||||
path := createTestJSON(t, "extensions.json", `{
|
||||
func setupMozExtensionJSON(t *testing.T) string {
|
||||
t.Helper()
|
||||
return createTestJSON(t, "extensions.json", `{
|
||||
"addons": [
|
||||
{
|
||||
"id": "ublock@gorhill.org",
|
||||
@@ -38,6 +39,10 @@ func TestExtractExtensions(t *testing.T) {
|
||||
}
|
||||
]
|
||||
}`)
|
||||
}
|
||||
|
||||
func TestExtractExtensions(t *testing.T) {
|
||||
path := setupMozExtensionJSON(t)
|
||||
|
||||
got, err := extractExtensions(path)
|
||||
require.NoError(t, err)
|
||||
@@ -54,6 +59,22 @@ func TestExtractExtensions(t *testing.T) {
|
||||
assert.False(t, ids["system@mozilla.org"])
|
||||
}
|
||||
|
||||
func TestCountExtensions(t *testing.T) {
|
||||
path := setupMozExtensionJSON(t)
|
||||
|
||||
count, err := countExtensions(path)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 2, count) // system addon filtered out
|
||||
}
|
||||
|
||||
func TestCountExtensions_Empty(t *testing.T) {
|
||||
path := createTestJSON(t, "extensions.json", `{"addons": []}`)
|
||||
|
||||
count, err := countExtensions(path)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 0, count)
|
||||
}
|
||||
|
||||
func TestExtractExtensions_EmptyAddons(t *testing.T) {
|
||||
path := createTestJSON(t, "extensions.json", `{"addons": []}`)
|
||||
got, err := extractExtensions(path)
|
||||
|
||||
Reference in New Issue
Block a user