v0.33.1 9577fee

profile_test.go RawHistoryFolder

1package cef
2
3import (
4	"context"
5	"errors"
6	"path/filepath"
7	"testing"
8
9	"github.com/bnema/dumber/internal/application/port"
10	"github.com/bnema/dumber/internal/logging"
11)
12
13func TestCEF2GTKProfilePathUsesSessionLogDirectory(t *testing.T) {
14	t.Setenv(cef2gtkProfileEnv, "1")
15	logDir := t.TempDir()
16	ctx := logging.WithSessionMetadata(context.Background(), "20260430_120000_abcd", filepath.Join(logDir, "session_20260430_120000_abcd.log"))
17	eng := &Engine{ctx: ctx, profileLogDir: filepath.Join(t.TempDir(), "fallback")}
18
19	got := eng.cef2gtkProfilePath()
20	want := filepath.Join(logDir, "session_20260430_120000_abcd_cef2gtk_profile.jsonl")
21	if got != want {
22		t.Fatalf("path = %q, want %q", got, want)
23	}
24}
25
26func TestCEF2GTKProfilePathUsesEngineProfileLogDirFallback(t *testing.T) {
27	profileLogDir := t.TempDir()
28	eng := &Engine{ctx: context.Background(), profileLogDir: profileLogDir}
29
30	got := eng.cef2gtkProfilePath()
31	want := filepath.Join(profileLogDir, "cef2gtk_profile.jsonl")
32	if got != want {
33		t.Fatalf("path = %q, want fallback output", got)
34	}
35}
36
37func TestCEF2GTKProfilePathAllowsExplicitOutput(t *testing.T) {
38	explicit := filepath.Join(t.TempDir(), "profile.jsonl")
39	t.Setenv(cef2gtkProfileOutputEnv, explicit)
40	eng := &Engine{ctx: context.Background()}
41
42	if got := eng.cef2gtkProfilePath(); got != explicit {
43		t.Fatalf("path = %q, want explicit output", got)
44	}
45}
46
47func TestCEF2GTKProfileOptionsDisabledByDefault(t *testing.T) {
48	eng := &Engine{ctx: context.Background()}
49	wv := &WebView{id: port.WebViewID(7)}
50
51	if opts := eng.cef2gtkProfileOptions(wv); opts.Enabled {
52		t.Fatal("profile options enabled without env")
53	}
54}
55
56func TestLockedProfileWriterWriteReturnsErrorWhenClosed(t *testing.T) {
57	var nilWriter *lockedProfileWriter
58	if _, err := nilWriter.Write([]byte("x")); !errors.Is(err, errProfileWriterClosed) {
59		t.Fatalf("nil writer error = %v, want %v", err, errProfileWriterClosed)
60	}
61
62	writer := &lockedProfileWriter{}
63	if _, err := writer.Write([]byte("x")); !errors.Is(err, errProfileWriterClosed) {
64		t.Fatalf("closed writer error = %v, want %v", err, errProfileWriterClosed)
65	}
66}

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