Files
terminalShop-old/pkg/tui/model_test.go
marcusDenslow 062242e346 feat: add browser-based card collection via Stripe Checkout Session
adds a /pay/{token} redirect endpoint that generates a short URL
pointing to a stripe checkout sessions in setup mode. The TUI shows a QR
code and URL on the payment page so users can add a card via the browser
instead of entering raw card data over SSH.

the checkout.session.completed webhook saves the card to the database.
the TUI polls GET /api/v1/cards every second and auto-proceeds to
confirmation once the new card is detected.

also adds a dev.sh startup script that runs all four required processes.
(SSH server, API server, Stripe CLI listener, ngrok) in a single
terminal
2026-04-08 01:03:43 +02:00

31 lines
632 B
Go

package tui
import (
"testing"
)
func TestModel_updateLayout(t *testing.T) {
tests := []struct {
name string
width int
height int
}{
{"large terminal", 120, 40},
{"medium terminal", 70, 25},
{"small terminal", 45, 20},
{"undersized", 15, 8},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
m := NewModel("")
m.updateLayout(tt.width, tt.height)
if m.viewportWidth != tt.width {
t.Errorf("viewportWidth = %d, want %d", m.viewportWidth, tt.width)
}
if m.viewportHeight != tt.height {
t.Errorf("viewportHeight = %d, want %d", m.viewportHeight, tt.height)
}
})
}
}