@@ -229,31 +229,17 @@ describe('Auth helpers', () => {
229229 afterEach ( ( ) => {
230230 vi . restoreAllMocks ( )
231231 } )
232-
233- it ( 'throws error with no user id' , async ( ) => {
234- await expect ( sendOnboardingEmail ( '' ) ) . rejects . toThrowError (
235- 'User id required' ,
236- )
237- } )
238-
239- it ( 'throws error with non-existent user id' , async ( ) => {
240- mocks . findById . mockResolvedValueOnce ( null )
241- await expect ( sendOnboardingEmail ( 'non-existent-id' ) ) . rejects . toThrowError (
242- 'User not found' ,
243- )
244- } )
245-
246232 it ( 'does not send email if user has logged in before' , async ( ) => {
247233 const mockUser = {
248234 id : 'test-id' ,
249235250236 lastLoginAt : new Date ( ) ,
251237 createdAt : new Date ( ) ,
252- }
238+ } as unknown as User
253239
254240 mocks . findById . mockResolvedValueOnce ( mockUser )
255241
256- await sendOnboardingEmail ( mockUser . id )
242+ await sendOnboardingEmail ( mockUser )
257243 expect ( axios . post ) . not . toHaveBeenCalled ( )
258244 } )
259245
@@ -262,11 +248,11 @@ describe('Auth helpers', () => {
262248 id : 'test-id' ,
263249264250 createdAt : new Date ( '2024-01-01' ) , // Before release date
265- }
251+ } as unknown as User
266252
267253 mocks . findById . mockResolvedValueOnce ( mockUser )
268254
269- await sendOnboardingEmail ( mockUser . id )
255+ await sendOnboardingEmail ( mockUser )
270256 expect ( axios . post ) . not . toHaveBeenCalled ( )
271257 } )
272258
@@ -275,11 +261,11 @@ describe('Auth helpers', () => {
275261 id : 'test-id' ,
276262277263 createdAt : new Date ( '2025-03-01' ) , // After release date
278- }
264+ } as unknown as User
279265
280266 mocks . findById . mockResolvedValueOnce ( mockUser )
281267
282- await sendOnboardingEmail ( mockUser . id )
268+ await sendOnboardingEmail ( mockUser )
283269 expect ( axios . post ) . not . toHaveBeenCalled ( )
284270 } )
285271
@@ -296,7 +282,7 @@ describe('Auth helpers', () => {
296282 mocks . findById . mockResolvedValueOnce ( mockUser )
297283 vi . mocked ( axios . post ) . mockResolvedValueOnce ( { data : { } } )
298284
299- await sendOnboardingEmail ( mockUser . id )
285+ await sendOnboardingEmail ( mockUser )
300286
301287 expect ( axios . post ) . toHaveBeenCalledWith (
302288 appConfig . onboardingEmailWebhookUrl ,
@@ -319,7 +305,7 @@ describe('Auth helpers', () => {
319305
320306 mocks . findById . mockResolvedValueOnce ( mockUser )
321307
322- await sendOnboardingEmail ( mockUser . id )
308+ await sendOnboardingEmail ( mockUser )
323309 expect ( axios . post ) . not . toHaveBeenCalled ( )
324310 } )
325311 } )
0 commit comments