detached 44cfca4

test(cef): use temp dir for download handler lifecycle

commit
44cfca44604f6443669628ec99fffb9676630d9d
author
brice · · 2026-04-20 05:57 UTC
parent
b04eecd
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
1 file · +4 -2
M internal/infrastructure/cef/download_handler_test.go +4 -2
@@ -3,6 +3,7 @@ package cef
33 import (
44 "context"
55 "fmt"
6+ "path/filepath"
67 "testing"
78
89 purecef "github.com/bnema/purego-cef/cef"
@@ -72,7 +73,8 @@ func TestCEFDownloadHandlerLifecycle(t *testing.T) {
7273 ctx := context.Background()
7374 preparer := usecase.NewPrepareDownloadUseCase(nil)
7475 events := &captureDownloadEvents{}
75- handler := newDownloadHandler("/tmp/downloads", events, preparer)
76+ downloadDir := t.TempDir()
77+ handler := newDownloadHandler(downloadDir, events, preparer)
7678 callback := &stubBeforeDownloadCallback{}
7779
7880 item := stubDownloadItem{
@@ -85,7 +87,7 @@ func TestCEFDownloadHandlerLifecycle(t *testing.T) {
8587 ok := handler.onBeforeDownload(ctx, nil, item, item.suggested, callback)
8688
8789 require.True(t, ok)
88- require.Equal(t, "/tmp/downloads/image.iso", callback.path)
90+ require.Equal(t, filepath.Join(downloadDir, "image.iso"), callback.path)
8991 require.Len(t, events.events, 1)
9092 require.Equal(t, port.DownloadEventStarted, events.events[0].Type)
9193
@@ -3,6 +3,7 @@ package cef
3 import (3 import (
4 "context"4 "context"
5 "fmt"5 "fmt"
6+ "path/filepath"
6 "testing"7 "testing"
7 8
8 purecef "github.com/bnema/purego-cef/cef"9 purecef "github.com/bnema/purego-cef/cef"
@@ -72,7 +73,8 @@ func TestCEFDownloadHandlerLifecycle(t *testing.T) {
72 ctx := context.Background()73 ctx := context.Background()
73 preparer := usecase.NewPrepareDownloadUseCase(nil)74 preparer := usecase.NewPrepareDownloadUseCase(nil)
74 events := &captureDownloadEvents{}75 events := &captureDownloadEvents{}
75- handler := newDownloadHandler("/tmp/downloads", events, preparer)76+ downloadDir := t.TempDir()
77+ handler := newDownloadHandler(downloadDir, events, preparer)
76 callback := &stubBeforeDownloadCallback{}78 callback := &stubBeforeDownloadCallback{}
77 79
78 item := stubDownloadItem{80 item := stubDownloadItem{
@@ -85,7 +87,7 @@ func TestCEFDownloadHandlerLifecycle(t *testing.T) {
85 ok := handler.onBeforeDownload(ctx, nil, item, item.suggested, callback)87 ok := handler.onBeforeDownload(ctx, nil, item, item.suggested, callback)
86 88
87 require.True(t, ok)89 require.True(t, ok)
88- require.Equal(t, "/tmp/downloads/image.iso", callback.path)90+ require.Equal(t, filepath.Join(downloadDir, "image.iso"), callback.path)
89 require.Len(t, events.events, 1)91 require.Len(t, events.events, 1)
90 require.Equal(t, port.DownloadEventStarted, events.events[0].Type)92 require.Equal(t, port.DownloadEventStarted, events.events[0].Type)
91 93

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close