@@ -3,7 +3,7 @@ import { exec } from '../../src/proxy/processors/push-action/checkAuthorEmails';
33import { Action } from '../../src/proxy/actions' ;
44import * as configModule from '../../src/config' ;
55import * as validator from 'validator' ;
6- import { Commit } from '../../src/proxy/actions/Action' ;
6+ import { CommitData } from '../../src/proxy/actions/Action' ;
77
88// mock dependencies
99vi . mock ( '../../src/config' , async ( importOriginal ) => {
@@ -66,8 +66,8 @@ describe('checkAuthorEmails', () => {
6666 describe ( 'basic email validation' , ( ) => {
6767 it ( 'should allow valid email addresses' , async ( ) => {
6868 mockAction . commitData = [
69- { authorEmail :
'[email protected] ' } as Commit , 70- { authorEmail :
'[email protected] ' } as Commit , 69+ { authorEmail :
'[email protected] ' } as CommitData , 70+ { authorEmail :
'[email protected] ' } as CommitData , 7171 ] ;
7272
7373 const result = await exec ( mockReq , mockAction ) ;
@@ -78,7 +78,7 @@ describe('checkAuthorEmails', () => {
7878 } ) ;
7979
8080 it ( 'should reject empty email' , async ( ) => {
81- mockAction . commitData = [ { authorEmail : '' } as Commit ] ;
81+ mockAction . commitData = [ { authorEmail : '' } as CommitData ] ;
8282
8383 const result = await exec ( mockReq , mockAction ) ;
8484
@@ -88,7 +88,7 @@ describe('checkAuthorEmails', () => {
8888
8989 it ( 'should reject null/undefined email' , async ( ) => {
9090 vi . mocked ( validator . isEmail ) . mockReturnValue ( false ) ;
91- mockAction . commitData = [ { authorEmail : null as any } as Commit ] ;
91+ mockAction . commitData = [ { authorEmail : null as any } as CommitData ] ;
9292
9393 const result = await exec ( mockReq , mockAction ) ;
9494
@@ -99,9 +99,9 @@ describe('checkAuthorEmails', () => {
9999 it ( 'should reject invalid email format' , async ( ) => {
100100 vi . mocked ( validator . isEmail ) . mockReturnValue ( false ) ;
101101 mockAction . commitData = [
102- { authorEmail : 'not-an-email' } as Commit ,
103- { authorEmail : 'missing@domain' } as Commit ,
104- { authorEmail : '@nodomain.com' } as Commit ,
102+ { authorEmail : 'not-an-email' } as CommitData ,
103+ { authorEmail : 'missing@domain' } as CommitData ,
104+ { authorEmail : '@nodomain.com' } as CommitData ,
105105 ] ;
106106
107107 const result = await exec ( mockReq , mockAction ) ;
@@ -127,8 +127,8 @@ describe('checkAuthorEmails', () => {
127127 } as any ) ;
128128
129129 mockAction . commitData = [
130- { authorEmail :
'[email protected] ' } as Commit , 131- { authorEmail :
'[email protected] ' } as Commit , 130+ { authorEmail :
'[email protected] ' } as CommitData , 131+ { authorEmail :
'[email protected] ' } as CommitData , 132132 ] ;
133133
134134 const result = await exec ( mockReq , mockAction ) ;
@@ -152,8 +152,8 @@ describe('checkAuthorEmails', () => {
152152 } as any ) ;
153153
154154 mockAction . commitData = [
155- { authorEmail :
'[email protected] ' } as Commit , 156- { authorEmail :
'[email protected] ' } as Commit , 155+ { authorEmail :
'[email protected] ' } as CommitData , 156+ { authorEmail :
'[email protected] ' } as CommitData , 157157 ] ;
158158
159159 const result = await exec ( mockReq , mockAction ) ;
@@ -177,8 +177,8 @@ describe('checkAuthorEmails', () => {
177177 } as any ) ;
178178
179179 mockAction . commitData = [
180- { authorEmail :
'[email protected] ' } as Commit , 181- { authorEmail :
'[email protected] ' } as Commit , 180+ { authorEmail :
'[email protected] ' } as CommitData , 181+ { authorEmail :
'[email protected] ' } as CommitData , 182182 ] ;
183183
184184 const result = await exec ( mockReq , mockAction ) ;
@@ -203,8 +203,8 @@ describe('checkAuthorEmails', () => {
203203 } as any ) ;
204204
205205 mockAction . commitData = [
206- { authorEmail :
'[email protected] ' } as Commit , 207- { authorEmail :
'[email protected] ' } as Commit , 206+ { authorEmail :
'[email protected] ' } as CommitData , 207+ { authorEmail :
'[email protected] ' } as CommitData , 208208 ] ;
209209
210210 const result = await exec ( mockReq , mockAction ) ;
@@ -230,8 +230,8 @@ describe('checkAuthorEmails', () => {
230230 } as any ) ;
231231
232232 mockAction . commitData = [
233- { authorEmail :
'[email protected] ' } as Commit , 234- { authorEmail :
'[email protected] ' } as Commit , 233+ { authorEmail :
'[email protected] ' } as CommitData , 234+ { authorEmail :
'[email protected] ' } as CommitData , 235235 ] ;
236236
237237 const result = await exec ( mockReq , mockAction ) ;
@@ -255,8 +255,8 @@ describe('checkAuthorEmails', () => {
255255 } as any ) ;
256256
257257 mockAction . commitData = [
258- { authorEmail :
'[email protected] ' } as Commit , 259- { authorEmail :
'[email protected] ' } as Commit , 258+ { authorEmail :
'[email protected] ' } as CommitData , 259+ { authorEmail :
'[email protected] ' } as CommitData , 260260 ] ;
261261
262262 const result = await exec ( mockReq , mockAction ) ;
@@ -280,9 +280,9 @@ describe('checkAuthorEmails', () => {
280280 } as any ) ;
281281
282282 mockAction . commitData = [
283- { authorEmail :
'[email protected] ' } as Commit , 284- { authorEmail :
'[email protected] ' } as Commit , 285- { authorEmail :
'[email protected] ' } as Commit , 283+ { authorEmail :
'[email protected] ' } as CommitData , 284+ { authorEmail :
'[email protected] ' } as CommitData , 285+ { authorEmail :
'[email protected] ' } as CommitData , 286286 ] ;
287287
288288 const result = await exec ( mockReq , mockAction ) ;
@@ -306,8 +306,8 @@ describe('checkAuthorEmails', () => {
306306 } as any ) ;
307307
308308 mockAction . commitData = [
309- { authorEmail :
'[email protected] ' } as Commit , 310- { authorEmail :
'[email protected] ' } as Commit , 309+ { authorEmail :
'[email protected] ' } as CommitData , 310+ { authorEmail :
'[email protected] ' } as CommitData , 311311 ] ;
312312
313313 const result = await exec ( mockReq , mockAction ) ;
@@ -333,9 +333,9 @@ describe('checkAuthorEmails', () => {
333333 } as any ) ;
334334
335335 mockAction . commitData = [
336- { authorEmail :
'[email protected] ' } as Commit , // valid 337- { authorEmail :
'[email protected] ' } as Commit , // invalid: blocked local 338- { authorEmail :
'[email protected] ' } as Commit , // invalid: wrong domain 336+ { authorEmail :
'[email protected] ' } as CommitData , // valid 337+ { authorEmail :
'[email protected] ' } as CommitData , // invalid: blocked local 338+ { authorEmail :
'[email protected] ' } as CommitData , // invalid: wrong domain 339339 ] ;
340340
341341 const result = await exec ( mockReq , mockAction ) ;
@@ -348,7 +348,7 @@ describe('checkAuthorEmails', () => {
348348
349349 describe ( 'exec function behavior' , ( ) => {
350350 it ( 'should create a step with name "checkAuthorEmails"' , async ( ) => {
351- mockAction . commitData = [ { authorEmail :
'[email protected] ' } as Commit ] ; 351+ mockAction . commitData = [ { authorEmail :
'[email protected] ' } as CommitData ] ; 352352
353353 await exec ( mockReq , mockAction ) ;
354354
@@ -361,11 +361,11 @@ describe('checkAuthorEmails', () => {
361361
362362 it ( 'should handle unique author emails correctly' , async ( ) => {
363363 mockAction . commitData = [
364- { authorEmail :
'[email protected] ' } as Commit , 365- { authorEmail :
'[email protected] ' } as Commit , 366- { authorEmail :
'[email protected] ' } as Commit , // Duplicate 367- { authorEmail :
'[email protected] ' } as Commit , 368- { authorEmail :
'[email protected] ' } as Commit , // Duplicate 364+ { authorEmail :
'[email protected] ' } as CommitData , 365+ { authorEmail :
'[email protected] ' } as CommitData , 366+ { authorEmail :
'[email protected] ' } as CommitData , // Duplicate 367+ { authorEmail :
'[email protected] ' } as CommitData , 368+ { authorEmail :
'[email protected] ' } as CommitData , // Duplicate 369369 ] ;
370370
371371 await exec ( mockReq , mockAction ) ;
@@ -395,15 +395,15 @@ describe('checkAuthorEmails', () => {
395395
396396 it ( 'should log error message when illegal emails found' , async ( ) => {
397397 vi . mocked ( validator . isEmail ) . mockReturnValue ( false ) ;
398- mockAction . commitData = [ { authorEmail : 'invalid-email' } as Commit ] ;
398+ mockAction . commitData = [ { authorEmail : 'invalid-email' } as CommitData ] ;
399399
400400 await exec ( mockReq , mockAction ) ;
401401 } ) ;
402402
403403 it ( 'should log success message when all emails are legal' , async ( ) => {
404404 mockAction . commitData = [
405- { authorEmail :
'[email protected] ' } as Commit , 406- { authorEmail :
'[email protected] ' } as Commit , 405+ { authorEmail :
'[email protected] ' } as CommitData , 406+ { authorEmail :
'[email protected] ' } as CommitData , 407407 ] ;
408408
409409 await exec ( mockReq , mockAction ) ;
@@ -415,7 +415,7 @@ describe('checkAuthorEmails', () => {
415415
416416 it ( 'should set error on step when illegal emails found' , async ( ) => {
417417 vi . mocked ( validator . isEmail ) . mockReturnValue ( false ) ;
418- mockAction . commitData = [ { authorEmail : 'bad@email' } as Commit ] ;
418+ mockAction . commitData = [ { authorEmail : 'bad@email' } as CommitData ] ;
419419
420420 await exec ( mockReq , mockAction ) ;
421421
@@ -425,7 +425,7 @@ describe('checkAuthorEmails', () => {
425425
426426 it ( 'should call step.setError with user-friendly message' , async ( ) => {
427427 vi . mocked ( validator . isEmail ) . mockReturnValue ( false ) ;
428- mockAction . commitData = [ { authorEmail : 'bad' } as Commit ] ;
428+ mockAction . commitData = [ { authorEmail : 'bad' } as CommitData ] ;
429429
430430 await exec ( mockReq , mockAction ) ;
431431
@@ -437,7 +437,7 @@ describe('checkAuthorEmails', () => {
437437 } ) ;
438438
439439 it ( 'should return the action object' , async ( ) => {
440- mockAction . commitData = [ { authorEmail :
'[email protected] ' } as Commit ] ; 440+ mockAction . commitData = [ { authorEmail :
'[email protected] ' } as CommitData ] ; 441441
442442 const result = await exec ( mockReq , mockAction ) ;
443443
@@ -446,9 +446,9 @@ describe('checkAuthorEmails', () => {
446446
447447 it ( 'should handle mixed valid and invalid emails' , async ( ) => {
448448 mockAction . commitData = [
449- { authorEmail :
'[email protected] ' } as Commit , 450- { authorEmail : 'invalid' } as Commit ,
451- { authorEmail :
'[email protected] ' } as Commit , 449+ { authorEmail :
'[email protected] ' } as CommitData , 450+ { authorEmail : 'invalid' } as CommitData ,
451+ { authorEmail :
'[email protected] ' } as CommitData , 452452 ] ;
453453
454454 vi . mocked ( validator . isEmail ) . mockImplementation ( ( email : string ) => {
@@ -471,7 +471,7 @@ describe('checkAuthorEmails', () => {
471471 describe ( 'edge cases' , ( ) => {
472472 it ( 'should handle email with multiple @ symbols' , async ( ) => {
473473 vi . mocked ( validator . isEmail ) . mockReturnValue ( false ) ;
474- mockAction . commitData = [ { authorEmail : 'user@@example.com' } as Commit ] ;
474+ mockAction . commitData = [ { authorEmail : 'user@@example.com' } as CommitData ] ;
475475
476476 const result = await exec ( mockReq , mockAction ) ;
477477
@@ -481,7 +481,7 @@ describe('checkAuthorEmails', () => {
481481
482482 it ( 'should handle email without domain' , async ( ) => {
483483 vi . mocked ( validator . isEmail ) . mockReturnValue ( false ) ;
484- mockAction . commitData = [ { authorEmail : 'user@' } as Commit ] ;
484+ mockAction . commitData = [ { authorEmail : 'user@' } as CommitData ] ;
485485
486486 const result = await exec ( mockReq , mockAction ) ;
487487
@@ -492,7 +492,7 @@ describe('checkAuthorEmails', () => {
492492 it ( 'should handle very long email addresses' , async ( ) => {
493493 const longLocal = 'a' . repeat ( 64 ) ;
494494 const longEmail = `${ longLocal } @example.com` ;
495- mockAction . commitData = [ { authorEmail : longEmail } as Commit ] ;
495+ mockAction . commitData = [ { authorEmail : longEmail } as CommitData ] ;
496496
497497 const result = await exec ( mockReq , mockAction ) ;
498498
@@ -501,9 +501,9 @@ describe('checkAuthorEmails', () => {
501501
502502 it ( 'should handle special characters in local part' , async ( ) => {
503503 mockAction . commitData = [
504- { authorEmail :
'[email protected] ' } as Commit , 505- { authorEmail :
'[email protected] ' } as Commit , 506- { authorEmail :
'[email protected] ' } as Commit , 504+ { authorEmail :
'[email protected] ' } as CommitData , 505+ { authorEmail :
'[email protected] ' } as CommitData , 506+ { authorEmail :
'[email protected] ' } as CommitData , 507507 ] ;
508508
509509 const result = await exec ( mockReq , mockAction ) ;
@@ -527,8 +527,8 @@ describe('checkAuthorEmails', () => {
527527 } as any ) ;
528528
529529 mockAction . commitData = [
530- { authorEmail :
'[email protected] ' } as Commit , 531- { authorEmail :
'[email protected] ' } as Commit , 530+ { authorEmail :
'[email protected] ' } as CommitData , 531+ { authorEmail :
'[email protected] ' } as CommitData , 532532 ] ;
533533
534534 const result = await exec ( mockReq , mockAction ) ;
0 commit comments