@@ -31,25 +31,25 @@ describe('Audit log fields functionality', () => {
3131
3232 if ( eventWithFields ) {
3333 expect ( Array . isArray ( eventWithFields . fields ) ) . toBe ( true )
34- eventWithFields . fields ! . forEach ( ( field ) => {
34+ for ( const field of eventWithFields . fields ! ) {
3535 expect ( typeof field ) . toBe ( 'string' )
3636 expect ( field . length ) . toBeGreaterThan ( 0 )
37- } )
37+ }
3838 }
3939 } )
4040
4141 test ( 'should handle events without fields gracefully' , ( ) => {
4242 // Some events might not have fields, this should not break anything
4343 const events = getAuditLogEvents ( 'organization' , 'enterprise-cloud@latest' )
4444
45- events . forEach ( ( event ) => {
45+ for ( const event of events ) {
4646 expect ( event ) . toHaveProperty ( 'action' )
4747 expect ( event ) . toHaveProperty ( 'description' )
4848 // fields property is optional
4949 if ( event . fields ) {
5050 expect ( Array . isArray ( event . fields ) ) . toBe ( true )
5151 }
52- } )
52+ }
5353 } )
5454
5555 test ( 'should include common audit log fields' , ( ) => {
@@ -82,19 +82,19 @@ describe('Audit log fields functionality', () => {
8282 expect ( categories . length ) . toBeGreaterThan ( 0 )
8383
8484 // Check that events in categories have proper structure including fields
85- categories . forEach ( ( category ) => {
85+ for ( const category of categories ) {
8686 const events = categorizedEvents [ category ]
8787 expect ( Array . isArray ( events ) ) . toBe ( true )
8888
89- events . forEach ( ( event : AuditLogEventT ) => {
89+ for ( const event of events as AuditLogEventT [ ] ) {
9090 expect ( event ) . toHaveProperty ( 'action' )
9191 expect ( event ) . toHaveProperty ( 'description' )
9292 // fields is optional but if present should be array
9393 if ( event . fields ) {
9494 expect ( Array . isArray ( event . fields ) ) . toBe ( true )
9595 }
96- } )
97- } )
96+ }
97+ }
9898 } )
9999
100100 test ( 'should preserve fields data through categorization' , ( ) => {
@@ -127,20 +127,20 @@ describe('Audit log fields functionality', () => {
127127 test ( 'should not have duplicate fields in same event' , ( ) => {
128128 const events = getAuditLogEvents ( 'organization' , 'enterprise-cloud@latest' )
129129
130- events . forEach ( ( event ) => {
130+ for ( const event of events ) {
131131 if ( event . fields ) {
132132 const uniqueFields = new Set ( event . fields )
133133 expect ( uniqueFields . size ) . toBe ( event . fields . length )
134134 }
135- } )
135+ }
136136 } )
137137
138138 test ( 'should have reasonable field names' , ( ) => {
139139 const events = getAuditLogEvents ( 'organization' , 'enterprise-cloud@latest' )
140140 const eventWithFields = events . find ( ( event ) => event . fields && event . fields . length > 0 )
141141
142142 if ( eventWithFields ) {
143- eventWithFields . fields ! . forEach ( ( field ) => {
143+ for ( const field of eventWithFields . fields ! ) {
144144 // Field names should be reasonable strings
145145 expect ( field ) . toBeTruthy ( )
146146 expect ( typeof field ) . toBe ( 'string' )
@@ -149,33 +149,33 @@ describe('Audit log fields functionality', () => {
149149
150150 // Should not contain special characters that would break display
151151 expect ( field ) . not . toMatch ( / [ < > ' " & ] / )
152- } )
152+ }
153153 }
154154 } )
155155
156156 test ( 'should handle different page types consistently' , ( ) => {
157157 const pageTypes = [ 'organization' , 'enterprise' , 'user' ]
158158
159- pageTypes . forEach ( ( pageType ) => {
159+ for ( const pageType of pageTypes ) {
160160 try {
161161 const events = getAuditLogEvents ( pageType , 'enterprise-cloud@latest' )
162162
163- events . forEach ( ( event ) => {
163+ for ( const event of events ) {
164164 expect ( event ) . toHaveProperty ( 'action' )
165165 expect ( event ) . toHaveProperty ( 'description' )
166166
167167 if ( event . fields ) {
168168 expect ( Array . isArray ( event . fields ) ) . toBe ( true )
169- event . fields . forEach ( ( field ) => {
169+ for ( const field of event . fields ) {
170170 expect ( typeof field ) . toBe ( 'string' )
171- } )
171+ }
172172 }
173- } )
173+ }
174174 } catch ( error ) {
175175 // Some page types might not exist for certain versions, that's ok
176176 console . log ( `Skipping ${ pageType } page type due to: ${ error } ` )
177177 }
178- } )
178+ }
179179 } )
180180 } )
181181
@@ -194,9 +194,9 @@ describe('Audit log fields functionality', () => {
194194
195195 if ( fields ) {
196196 expect ( Array . isArray ( fields ) ) . toBe ( true )
197- fields . forEach ( ( field ) => {
197+ for ( const field of fields ) {
198198 expect ( typeof field ) . toBe ( 'string' )
199- } )
199+ }
200200 }
201201 } )
202202 } )
0 commit comments