github.com/tilt-dev/tilt@v0.33.15-0.20240515162809-0a22ed45d8a0/internal/hud/hud_test.go (about) 1 package hud 2 3 import ( 4 "bytes" 5 "net/url" 6 "testing" 7 "time" 8 9 "github.com/gdamore/tcell" 10 11 "github.com/tilt-dev/tilt/internal/openurl" 12 "github.com/tilt-dev/tilt/internal/rty" 13 "github.com/tilt-dev/tilt/internal/testutils" 14 "github.com/tilt-dev/tilt/pkg/model" 15 ) 16 17 func TestRenderInit(t *testing.T) { 18 logs := new(bytes.Buffer) 19 ctx, _, ta := testutils.ForkedCtxAndAnalyticsForTest(logs) 20 21 clockForTest := func() time.Time { return time.Date(2017, 1, 1, 12, 0, 0, 0, time.UTC) } 22 r := NewRenderer(clockForTest) 23 r.rty = rty.NewRTY(tcell.NewSimulationScreen(""), t) 24 webURL, _ := url.Parse("http://localhost:10350") 25 hud := NewHud(r, model.WebURL(*webURL), ta, openurl.BrowserOpen) 26 hud.(*Hud).refresh(ctx) // Ensure we render without error 27 }