mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-08-24 00:22:29 +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,11 +7,16 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestExtractDownloads(t *testing.T) {
|
||||
path := createTestDB(t, "History", downloadsSchema,
|
||||
func setupDownloadDB(t *testing.T) string {
|
||||
t.Helper()
|
||||
return createTestDB(t, "History", downloadsSchema,
|
||||
insertDownload("/tmp/old.zip", "https://old.com/file.zip", "application/zip", 1024, 13340000000000000, 13340000100000000),
|
||||
insertDownload("/tmp/new.pdf", "https://new.com/doc.pdf", "application/pdf", 2048, 13360000000000000, 13360000200000000),
|
||||
)
|
||||
}
|
||||
|
||||
func TestExtractDownloads(t *testing.T) {
|
||||
path := setupDownloadDB(t)
|
||||
|
||||
got, err := extractDownloads(path)
|
||||
require.NoError(t, err)
|
||||
@@ -29,3 +34,19 @@ func TestExtractDownloads(t *testing.T) {
|
||||
assert.False(t, got[0].EndTime.IsZero())
|
||||
assert.True(t, got[0].StartTime.Before(got[0].EndTime))
|
||||
}
|
||||
|
||||
func TestCountDownloads(t *testing.T) {
|
||||
path := setupDownloadDB(t)
|
||||
|
||||
count, err := countDownloads(path)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 2, count)
|
||||
}
|
||||
|
||||
func TestCountDownloads_Empty(t *testing.T) {
|
||||
path := createTestDB(t, "History", downloadsSchema)
|
||||
|
||||
count, err := countDownloads(path)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 0, count)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user