mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-05-23 19:14:01 +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,12 +7,17 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestExtractLocalStorage(t *testing.T) {
|
||||
path := createTestDB(t, "webappsstore.sqlite", []string{webappsstore2Schema},
|
||||
func setupWebappsDB(t *testing.T) string {
|
||||
t.Helper()
|
||||
return createTestDB(t, "webappsstore.sqlite", []string{webappsstore2Schema},
|
||||
insertWebappsstore("moc.buhtig.:https:443", "theme", "dark"),
|
||||
insertWebappsstore("moc.buhtig.:https:443", "lang", "en"),
|
||||
insertWebappsstore("moc.elpmaxe.:http:8080", "token", "abc123"),
|
||||
)
|
||||
}
|
||||
|
||||
func TestExtractLocalStorage(t *testing.T) {
|
||||
path := setupWebappsDB(t)
|
||||
|
||||
got, err := extractLocalStorage(path)
|
||||
require.NoError(t, err)
|
||||
@@ -28,6 +33,22 @@ func TestExtractLocalStorage(t *testing.T) {
|
||||
assert.Equal(t, "abc123", byKey["http://example.com:8080/token"])
|
||||
}
|
||||
|
||||
func TestCountLocalStorage(t *testing.T) {
|
||||
path := setupWebappsDB(t)
|
||||
|
||||
count, err := countLocalStorage(path)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 3, count)
|
||||
}
|
||||
|
||||
func TestCountLocalStorage_Empty(t *testing.T) {
|
||||
path := createTestDB(t, "webappsstore.sqlite", []string{webappsstore2Schema})
|
||||
|
||||
count, err := countLocalStorage(path)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 0, count)
|
||||
}
|
||||
|
||||
func TestParseOriginKey(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
Reference in New Issue
Block a user