@@ -56,48 +56,44 @@ describe("React Mounting", async () => {
56
56
// importing main.tsx has side effects that I could not clean up and can only be done once (per file),
57
57
// so I am using one test and many annotations. It's possible that there's a better way, but I couldn't
58
58
// find it in 4 hours of trying
59
- test (
60
- "App fully mounts through main.tsx" ,
61
- async ( { annotate, skip } ) => {
62
- skip ( server . browser == "firefox" , "WebGL bug in Github Actions on Firefox" )
63
-
64
- await import ( "@/main.tsx" )
65
-
66
- expect ( window . convertAuthToken ) . toBeDefined ( )
67
- expectTypeOf ( window . convertAuthToken ) . toBeFunction ( )
68
- expect ( window . gtag ) . toBeDefined ( )
69
- expectTypeOf ( window . gtag ) . toBeFunction ( )
70
- await annotate ( "expected global functions mount" )
71
-
72
- // assorted style rules from index.css
73
- const style = window . getComputedStyle ( document . body )
74
- expect ( style . overflow ) . toBe ( "hidden" )
75
- expect ( style . overscrollBehavior ) . toBe ( "none" )
76
- expect ( style . fontFamily . split ( "," ) [ 0 ] . trim ( ) ) . toBe ( "Artifakt" )
77
- await annotate ( "index.css applied correctly" )
78
-
79
- expect ( renderMock ) . toHaveBeenCalledOnce ( )
80
- assert ( screen != null , "Screen was null" )
81
-
82
- const screenElement = screen . baseElement
83
- expect ( screenElement . querySelector ( "canvas" ) ) . toBeInTheDocument ( )
84
- expect ( screen . getByText ( "Singleplayer" ) ) . toBeInTheDocument ( )
85
- await annotate ( "DOM successfully updated to include Synthesis components" )
86
- const initWorldSpy = vi . spyOn ( World , "initWorld" )
87
- await screen . getByText ( "Singleplayer" ) . click ( )
88
- expect ( initWorldSpy ) . toHaveBeenCalledOnce ( )
89
- await annotate ( "Singleplayer Button calls initWorld" )
90
-
91
- await wait ( 50 )
92
-
93
- await annotate ( "Initial Scene DOM" , { contentType : "text/html" , body : document . documentElement . outerHTML } )
94
-
95
- screen . unmount ( )
96
-
97
- await annotate ( "Screen unmounted gracefully" )
98
- } ,
99
- { timeout : 20000 }
100
- )
59
+ test ( "App fully mounts through main.tsx" , async ( { annotate, skip } ) => {
60
+ skip ( server . browser == "firefox" , "WebGL bug in Github Actions on Firefox" )
61
+
62
+ await import ( "@/main.tsx" )
63
+
64
+ expect ( window . convertAuthToken ) . toBeDefined ( )
65
+ expectTypeOf ( window . convertAuthToken ) . toBeFunction ( )
66
+ expect ( window . gtag ) . toBeDefined ( )
67
+ expectTypeOf ( window . gtag ) . toBeFunction ( )
68
+ await annotate ( "expected global functions mount" )
69
+
70
+ // assorted style rules from index.css
71
+ const style = window . getComputedStyle ( document . body )
72
+ expect ( style . overflow ) . toBe ( "hidden" )
73
+ expect ( style . overscrollBehavior ) . toBe ( "none" )
74
+ expect ( style . fontFamily . split ( "," ) [ 0 ] . trim ( ) ) . toBe ( "Artifakt" )
75
+ await annotate ( "index.css applied correctly" )
76
+
77
+ expect ( renderMock ) . toHaveBeenCalledOnce ( )
78
+ assert ( screen != null , "Screen was null" )
79
+
80
+ const screenElement = screen . baseElement
81
+ expect ( screenElement . querySelector ( "canvas" ) ) . toBeInTheDocument ( )
82
+ expect ( screen . getByText ( "Singleplayer" ) ) . toBeInTheDocument ( )
83
+ await annotate ( "DOM successfully updated to include Synthesis components" )
84
+ const initWorldSpy = vi . spyOn ( World , "initWorld" )
85
+ await screen . getByText ( "Singleplayer" ) . click ( )
86
+ expect ( initWorldSpy ) . toHaveBeenCalledOnce ( )
87
+ await annotate ( "Singleplayer Button calls initWorld" )
88
+
89
+ await wait ( 50 )
90
+
91
+ await annotate ( "Initial Scene DOM" , { contentType : "text/html" , body : document . documentElement . outerHTML } )
92
+
93
+ screen . unmount ( )
94
+
95
+ await annotate ( "Screen unmounted gracefully" )
96
+ } , 20000 )
101
97
} )
102
98
103
99
function wait ( milliseconds : number ) {
0 commit comments