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:
Roger
2026-04-07 22:28:39 +08:00
committed by GitHub
parent 5f42d4fe5f
commit b3bbc0dadf
40 changed files with 1009 additions and 101 deletions
+23 -2
View File
@@ -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)