File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
packages/sveltekit/test/server-common Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -91,5 +91,29 @@ describe('handleError', () => {
91
91
// Check that the default handler wasn't invoked
92
92
expect ( consoleErrorSpy ) . toHaveBeenCalledTimes ( 0 ) ;
93
93
} ) ;
94
+
95
+ it ( 'calls waitUntil if available' , async ( ) => {
96
+ const wrappedHandleError = handleErrorWithSentry ( ) ;
97
+ const mockError = new Error ( 'test' ) ;
98
+ const waitUntilSpy = vi . fn ( ) ;
99
+
100
+ await wrappedHandleError ( {
101
+ error : mockError ,
102
+ event : {
103
+ ...requestEvent ,
104
+ platform : {
105
+ context : {
106
+ waitUntil : waitUntilSpy ,
107
+ } ,
108
+ } ,
109
+ } ,
110
+ status : 500 ,
111
+ message : 'Internal Error' ,
112
+ } ) ;
113
+
114
+ expect ( waitUntilSpy ) . toHaveBeenCalledTimes ( 1 ) ;
115
+ // flush() returns a promise, this is what we expect here
116
+ expect ( waitUntilSpy ) . toHaveBeenCalledWith ( expect . any ( Promise ) ) ;
117
+ } ) ;
94
118
} ) ;
95
119
} ) ;
You can’t perform that action at this time.
0 commit comments