@@ -162,6 +162,7 @@ func TestHash(t *testing.T) {
162162
163163 roots , err := app .Run (context .Background ())
164164 require .NoError (t , err )
165+ assert .False (t , ScreensFromRoots (roots ).Empty ())
165166
166167 // ensure we can calculate a hash
167168 hash , err := ScreensFromRoots (roots ).Hash ()
@@ -185,11 +186,33 @@ func TestHash(t *testing.T) {
185186
186187 // ensure we can calculate a hash on the new app
187188 hash2 , err := ScreensFromRoots (roots2 ).Hash ()
189+ require .NoError (t , err )
188190
189191 // ensure hashes are different
190192 require .NotEqual (t , hash , hash2 )
191193}
192194
195+ func TestHashEmptyApp (t * testing.T ) {
196+ app , err := runtime .NewApplet ("test.star" , []byte (`def main(): return []` ))
197+ require .NoError (t , err )
198+
199+ roots , err := app .Run (context .Background ())
200+ require .NoError (t , err )
201+ assert .True (t , ScreensFromRoots (roots ).Empty ())
202+
203+ // ensure we can calculate a hash
204+ hash , err := ScreensFromRoots (roots ).Hash ()
205+ require .NoError (t , err )
206+ require .True (t , len (hash ) > 0 )
207+
208+ // ensure the hash doesn't change
209+ for i := 0 ; i < 20 ; i ++ {
210+ h , err := ScreensFromRoots (roots ).Hash ()
211+ assert .NoError (t , err )
212+ assert .Equal (t , hash , h )
213+ }
214+ }
215+
193216func TestHashDelayAndMaxAge (t * testing.T ) {
194217 r := []render.Root {{Child : & render.Text {Content : "derp" }}}
195218
0 commit comments