okami.mom/albedo
git clone https://git.nkp.pet/okami.mom/albedo
8e3e173
main
1//go:build unix 2 3// /quota crosses the composer, the quota screen, the client's read of the 4// daemon's /server route and the daemon's own answer. A fixed Server fixture 5// cannot show the client decoding what the daemon really sends: a hermetic 6// daemon has no accounts to poll, so the screen must say so and still leave. 7package e2e 8 9import ( 10"strings" 11"testing" 12 13"albedo/cli/internal/tui" 14 15 tea"charm.land/bubbletea/v2" 16) 17 18func TestTUIQuotaOpensOnTheDaemonsReadingsAndLeaves (t * testing.T ) { 19providerRoute (t ,echoReply ) 20t .Parallel () 21d := newTUIDriver (t ) 22d .Update (tea.WindowSizeMsg {Width :120 ,Height :30 }) 23 24d .App .Chat .TextArea .SetValue ("/quota" ) 25d .Dispatch (tea.KeyPressMsg {Code :tea .KeyEnter }) 26if d .App .State != tui .AppStateQuota { 27t .Fatalf ("/quota did not open the quota screen:\n%s" ,d .View ()) 28 } 29if d .App .Quota .Loading || d .App .Quota .Error != "" { 30t .Fatalf ("the quota read did not settle (loading %v, error %q):\n%s" ,d .App .Quota .Loading ,d .App .Quota .Error ,d .View ()) 31 } 32if view := d .View ();! strings .Contains (view ,"No quota readings yet" ) { 33t .Fatalf ("a daemon with no accounts should say there are no readings:\n%s" ,view ) 34 } 35 36d .Dispatch (tea.KeyPressMsg {Code :tea .KeyEscape }) 37if d .App .State != tui .AppStateChat { 38t .Fatalf ("esc did not return to the chat:\n%s" ,d .View ()) 39 } 40}