test(daemon): table-drive move picker capability cases
Signed-off-by: brice <b@bnema.dev>
- commit
- 114345bc8571b7fa2f7bbc0172233455a1d16934
- author
- brice · · 2026-07-29 20:17 UTC
- parent
- d75f483
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +15 -6
M internal/usecase/daemon/session_capabilities_test.go +15 -6
| @@ -37,12 +37,21 @@ func TestSnapshotViewCarriesCannotAcceptMoves(t *testing.T) { | |||
| 37 | 37 | func TestEnterPickerForIntentRejectsNonYieldingSource(t *testing.T) { | |
| 38 | 38 | d, sess, ac, _ := newManualSessionWithPTYs(t) | |
| 39 | 39 | sess.caps = sessionCapabilities{cannotYieldMoves: true} | |
| 40 | - | err := d.enterPickerForIntent(sess, ac, pickerMoveTab, moveSourceLocator{}) | |
| 41 | - | if !errors.Is(err, errSessionCannotYieldMoves) { | |
| 42 | - | t.Fatalf("enterPickerForIntent error = %v, want errSessionCannotYieldMoves", err) | |
| 40 | + | ||
| 41 | + | tests := []struct { | |
| 42 | + | name string | |
| 43 | + | intent pickerIntent | |
| 44 | + | wantErr error | |
| 45 | + | }{ | |
| 46 | + | {name: "pickerMoveTab", intent: pickerMoveTab, wantErr: errSessionCannotYieldMoves}, | |
| 47 | + | {name: "pickerNavigate", intent: pickerNavigate, wantErr: nil}, | |
| 43 | 48 | } | |
| 44 | - | // Navigation intent must stay unaffected by the yield capability. | |
| 45 | - | if err := d.enterPickerForIntent(sess, ac, pickerNavigate, moveSourceLocator{}); err != nil { | |
| 46 | - | t.Fatalf("navigate intent returned %v, want nil", err) | |
| 49 | + | for _, tt := range tests { | |
| 50 | + | t.Run(tt.name, func(t *testing.T) { | |
| 51 | + | err := d.enterPickerForIntent(sess, ac, tt.intent, moveSourceLocator{}) | |
| 52 | + | if !errors.Is(err, tt.wantErr) { | |
| 53 | + | t.Fatalf("enterPickerForIntent error = %v, want %v", err, tt.wantErr) | |
| 54 | + | } | |
| 55 | + | }) | |
| 47 | 56 | } | |
| 48 | 57 | } | |
| @@ -37,12 +37,21 @@ func TestSnapshotViewCarriesCannotAcceptMoves(t *testing.T) { | |||||
| 37 | func TestEnterPickerForIntentRejectsNonYieldingSource(t *testing.T) { | 37 | func TestEnterPickerForIntentRejectsNonYieldingSource(t *testing.T) { | ||
| 38 | d, sess, ac, _ := newManualSessionWithPTYs(t) | 38 | d, sess, ac, _ := newManualSessionWithPTYs(t) | ||
| 39 | sess.caps = sessionCapabilities{cannotYieldMoves: true} | 39 | sess.caps = sessionCapabilities{cannotYieldMoves: true} | ||
| 40 | - | err := d.enterPickerForIntent(sess, ac, pickerMoveTab, moveSourceLocator{}) | 40 | + | |
| 41 | - | if !errors.Is(err, errSessionCannotYieldMoves) { | 41 | + | tests := []struct { |
| 42 | - | t.Fatalf("enterPickerForIntent error = %v, want errSessionCannotYieldMoves", err) | 42 | + | name string |
| 43 | + | intent pickerIntent | |||
| 44 | + | wantErr error | |||
| 45 | + | }{ | |||
| 46 | + | {name: "pickerMoveTab", intent: pickerMoveTab, wantErr: errSessionCannotYieldMoves}, | |||
| 47 | + | {name: "pickerNavigate", intent: pickerNavigate, wantErr: nil}, | |||
| 43 | } | 48 | } | ||
| 44 | - | // Navigation intent must stay unaffected by the yield capability. | 49 | + | for _, tt := range tests { |
| 45 | - | if err := d.enterPickerForIntent(sess, ac, pickerNavigate, moveSourceLocator{}); err != nil { | 50 | + | t.Run(tt.name, func(t *testing.T) { |
| 46 | - | t.Fatalf("navigate intent returned %v, want nil", err) | 51 | + | err := d.enterPickerForIntent(sess, ac, tt.intent, moveSourceLocator{}) |
| 52 | + | if !errors.Is(err, tt.wantErr) { | |||
| 53 | + | t.Fatalf("enterPickerForIntent error = %v, want %v", err, tt.wantErr) | |||
| 54 | + | } | |||
| 55 | + | }) | |||
| 47 | } | 56 | } | ||
| 48 | } | 57 | } | ||