@@ -371,148 +371,6 @@ describe('AuditBaseCommand class', () => {
371371 } ) ;
372372 } ) ;
373373
374- describe ( 'prepareReport method - Report file names' , ( ) => {
375- fancy
376- . stdout ( { print : process . env . PRINT === 'true' || false } )
377- . stub ( winston . transports , 'File' , ( ) => fsTransport )
378- . stub ( winston , 'createLogger' , createMockWinstonLogger )
379- . stub ( fs , 'createWriteStream' , ( ) => new PassThrough ( ) )
380- . stub ( fs , 'mkdirSync' , ( ) => { } )
381- . stub ( fs , 'existsSync' , ( ) => true )
382- . it ( 'should generate report file with correct spelling: Entries_Select_field (not feild)' , async ( ) => {
383- const writeFileSyncSpy = sinon . spy ( fs , 'writeFileSync' ) ;
384- class CMD extends AuditBaseCommand {
385- async run ( ) {
386- await this . init ( ) ;
387- this . sharedConfig . reportPath = resolve ( __dirname , 'mock' , 'contents' ) ;
388-
389- await this . prepareReport ( 'Entries_Select_field' , {
390- entry1 : {
391- name : 'Test Entry' ,
392- display_name : 'Select Field' ,
393- missingRefs : [ 'ref1' ] ,
394- } ,
395- } ) ;
396-
397- const jsonCall = writeFileSyncSpy . getCalls ( ) . find ( call =>
398- typeof call . args [ 0 ] === 'string' && call . args [ 0 ] . includes ( '.json' )
399- ) ;
400- return jsonCall ? ( jsonCall . args [ 0 ] as string ) : undefined ;
401- }
402- }
403-
404- const result = await CMD . run ( [ ] ) ;
405- writeFileSyncSpy . restore ( ) ;
406- expect ( result ) . to . include ( 'Entries_Select_field.json' ) ;
407- expect ( result ) . to . not . include ( 'Entries_Select_feild' ) ;
408- } ) ;
409-
410- fancy
411- . stdout ( { print : process . env . PRINT === 'true' || false } )
412- . stub ( winston . transports , 'File' , ( ) => fsTransport )
413- . stub ( winston , 'createLogger' , createMockWinstonLogger )
414- . stub ( fs , 'createWriteStream' , ( ) => new PassThrough ( ) )
415- . stub ( fs , 'mkdirSync' , ( ) => { } )
416- . stub ( fs , 'existsSync' , ( ) => true )
417- . it ( 'should generate report file with correct spelling: Entries_Mandatory_field (not feild)' , async ( ) => {
418- const writeFileSyncSpy = sinon . spy ( fs , 'writeFileSync' ) ;
419- class CMD extends AuditBaseCommand {
420- async run ( ) {
421- await this . init ( ) ;
422- this . sharedConfig . reportPath = resolve ( __dirname , 'mock' , 'contents' ) ;
423-
424- await this . prepareReport ( 'Entries_Mandatory_field' , {
425- entry1 : {
426- name : 'Test Entry' ,
427- display_name : 'Mandatory Field' ,
428- missingRefs : [ 'ref1' ] ,
429- } ,
430- } ) ;
431-
432- const jsonCall = writeFileSyncSpy . getCalls ( ) . find ( call =>
433- typeof call . args [ 0 ] === 'string' && call . args [ 0 ] . includes ( '.json' )
434- ) ;
435- return jsonCall ? ( jsonCall . args [ 0 ] as string ) : undefined ;
436- }
437- }
438-
439- const result = await CMD . run ( [ ] ) ;
440- writeFileSyncSpy . restore ( ) ;
441- expect ( result ) . to . include ( 'Entries_Mandatory_field.json' ) ;
442- expect ( result ) . to . not . include ( 'Entries_Mandatory_feild' ) ;
443- } ) ;
444-
445- fancy
446- . stdout ( { print : process . env . PRINT === 'true' || false } )
447- . stub ( winston . transports , 'File' , ( ) => fsTransport )
448- . stub ( winston , 'createLogger' , createMockWinstonLogger )
449- . stub ( fs , 'createWriteStream' , ( ) => new PassThrough ( ) )
450- . stub ( fs , 'mkdirSync' , ( ) => { } )
451- . stub ( fs , 'existsSync' , ( ) => true )
452- . it ( 'should generate report file with correct spelling: Entries_Title_field (not feild)' , async ( ) => {
453- const writeFileSyncSpy = sinon . spy ( fs , 'writeFileSync' ) ;
454- class CMD extends AuditBaseCommand {
455- async run ( ) {
456- await this . init ( ) ;
457- this . sharedConfig . reportPath = resolve ( __dirname , 'mock' , 'contents' ) ;
458-
459- await this . prepareReport ( 'Entries_Title_field' , {
460- entry1 : {
461- name : 'Test Entry' ,
462- display_name : 'Title Field' ,
463- missingRefs : [ 'ref1' ] ,
464- } ,
465- } ) ;
466-
467- const jsonCall = writeFileSyncSpy . getCalls ( ) . find ( call =>
468- typeof call . args [ 0 ] === 'string' && call . args [ 0 ] . includes ( '.json' )
469- ) ;
470- return jsonCall ? ( jsonCall . args [ 0 ] as string ) : undefined ;
471- }
472- }
473-
474- const result = await CMD . run ( [ ] ) ;
475- writeFileSyncSpy . restore ( ) ;
476- expect ( result ) . to . include ( 'Entries_Title_field.json' ) ;
477- expect ( result ) . to . not . include ( 'Entries_Title_feild' ) ;
478- } ) ;
479- } ) ;
480-
481- describe ( 'Config - ReportTitleForEntries keys' , ( ) => {
482- it ( 'should have correct spelling in ReportTitleForEntries config' , ( ) => {
483- const config = require ( '../../src/config' ) . default ;
484-
485- // Verify correct spelling (field, not feild)
486- expect ( config . ReportTitleForEntries ) . to . have . property ( 'Entries_Select_field' ) ;
487- expect ( config . ReportTitleForEntries ) . to . have . property ( 'Entries_Mandatory_field' ) ;
488- expect ( config . ReportTitleForEntries ) . to . have . property ( 'Entries_Title_field' ) ;
489-
490- // Verify old typo is not present
491- expect ( config . ReportTitleForEntries ) . to . not . have . property ( 'Entries_Select_feild' ) ;
492- expect ( config . ReportTitleForEntries ) . to . not . have . property ( 'Entries_Mandatory_feild' ) ;
493- expect ( config . ReportTitleForEntries ) . to . not . have . property ( 'Entries_Title_feild' ) ;
494-
495- // Verify values match keys
496- expect ( config . ReportTitleForEntries . Entries_Select_field ) . to . equal ( 'Entries_Select_field' ) ;
497- expect ( config . ReportTitleForEntries . Entries_Mandatory_field ) . to . equal ( 'Entries_Mandatory_field' ) ;
498- expect ( config . ReportTitleForEntries . Entries_Title_field ) . to . equal ( 'Entries_Title_field' ) ;
499- } ) ;
500-
501- it ( 'should have correct spelling in feild_level_modules array' , ( ) => {
502- const config = require ( '../../src/config' ) . default ;
503-
504- // Verify correct spelling in the array
505- expect ( config . feild_level_modules ) . to . include ( 'Entries_Select_field' ) ;
506- expect ( config . feild_level_modules ) . to . include ( 'Entries_Mandatory_field' ) ;
507- expect ( config . feild_level_modules ) . to . include ( 'Entries_Title_field' ) ;
508-
509- // Verify old typo is not present
510- expect ( config . feild_level_modules ) . to . not . include ( 'Entries_Select_feild' ) ;
511- expect ( config . feild_level_modules ) . to . not . include ( 'Entries_Mandatory_feild' ) ;
512- expect ( config . feild_level_modules ) . to . not . include ( 'Entries_Title_feild' ) ;
513- } ) ;
514- } ) ;
515-
516374 describe ( 'Progress Manager Integration' , ( ) => {
517375 let configHandlerStub : sinon . SinonStub ;
518376 let initializeGlobalSummarySpy : sinon . SinonSpy ;
0 commit comments