Skip to content

Commit f332a7a

Browse files
committed
Test single-category browser imports
1 parent 1df5efb commit f332a7a

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

internal/browserimport/bundle_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,23 @@ func TestBundleTooLargeErrorReportsMiBWithoutLosingCause(t *testing.T) {
3434
require.ErrorIs(t, err, ErrBundleTooLarge)
3535
}
3636

37+
func TestBuildProfileBundleAcceptsEachCategoryAlone(t *testing.T) {
38+
profile := Profile{ID: "helium-default-1234", Name: "Personal", Browser: Browser{ID: "helium", Name: "Helium"}}
39+
tests := map[string]ProfileData{
40+
"cookies": {Cookies: []Cookie{{Domain: ".example.com", Path: "/", Name: "session", Value: "secret"}}},
41+
"storage": {Storage: []StorageRecord{{Origin: "https://example.com", Kind: StorageKindLocal, Key: "theme", Value: "dark"}}},
42+
"bookmarks": {Bookmarks: &BookmarkDocument{Roots: []BookmarkRoot{}}},
43+
"history": {History: []HistoryRecord{{URL: "https://example.com", Title: "Example"}}},
44+
}
45+
for name, data := range tests {
46+
t.Run(name, func(t *testing.T) {
47+
bundle, err := BuildProfileBundle(t.Context(), profile, "my-browser", "test", data)
48+
require.NoError(t, err)
49+
require.NotEmpty(t, bundle)
50+
})
51+
}
52+
}
53+
3754
func TestBuildProfileBundleIncludesOnlySelectedCategories(t *testing.T) {
3855
profile := Profile{ID: "helium-default-1234", Name: "Personal", Browser: Browser{ID: "helium", Name: "Helium"}}
3956
bundle, err := BuildProfileBundle(t.Context(), profile, "my-browser", "test", ProfileData{

0 commit comments

Comments
 (0)