v0.3.0 99dc266

remote_stopped_selector_test.go RawHistoryFolder

1package daemon
2
3import (
4	"testing"
5
6	"github.com/stretchr/testify/require"
7
8	"github.com/bnema/vev/internal/domain"
9)
10
11func TestRemoteStoppedSelectorsResolveOnlyAgainstExactTabMetadata(t *testing.T) {
12	lifecycle := remoteLifecycleForTest()
13	stopped := stoppedSession{
14		name: "work", incarnation: lifecycle,
15		tabNames: []string{"alpha", "beta"},
16		tabRecords: []domain.CatalogueTabRecord{
17			{StableID: "tab-a", Name: "alpha"},
18			{StableID: "tab-b", Name: "beta"},
19		},
20	}
21
22	stable := domain.RemoteSessionTarget{
23		Endpoint: "arch", DisplayOrigin: "arch", LifecycleID: lifecycle,
24		SessionName: "work", Stopped: true,
25		StoppedTab: domain.NewStableTabSelector("tab-b"),
26	}
27	index, ok := remoteTargetTabIndexStopped(stopped, stable)
28	require.True(t, ok)
29	require.Equal(t, 1, index)
30
31	ordinal := stable
32	ordinal.StoppedTab = domain.NewOrdinalTabSelector(1, "beta", 2)
33	index, ok = remoteTargetTabIndexStopped(stopped, ordinal)
34	require.True(t, ok)
35	require.Equal(t, 1, index)
36
37	for _, invalid := range []domain.RemoteSessionTarget{
38		func() domain.RemoteSessionTarget {
39			candidate := stable
40			candidate.StoppedTab = domain.NewStableTabSelector("missing")
41			return candidate
42		}(),
43		func() domain.RemoteSessionTarget {
44			candidate := ordinal
45			candidate.StoppedTab = domain.NewOrdinalTabSelector(1, "replaced", 2)
46			return candidate
47		}(),
48		func() domain.RemoteSessionTarget {
49			candidate := ordinal
50			candidate.StoppedTab = domain.NewOrdinalTabSelector(1, "beta", 3)
51			return candidate
52		}(),
53	} {
54		_, ok := remoteTargetTabIndexStopped(stopped, invalid)
55		require.False(t, ok)
56	}
57
58	reordered := stopped
59	reordered.tabRecords = []domain.CatalogueTabRecord{
60		{StableID: "tab-b", Name: "beta"},
61		{StableID: "tab-a", Name: "alpha"},
62	}
63	index, ok = remoteTargetTabIndexStopped(reordered, stable)
64	require.True(t, ok)
65	require.Equal(t, 0, index, "stable selectors follow identity, not the old ordinal")
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 12

Tags 11

↑↓ moveenter openesc close