@@ -613,4 +613,95 @@ describe('FlexCard Standard Data Model (Metadata API Disabled) - Assessment and
613613 expect ( result . OmniUiCardKey ) . to . equal ( 'TestCard/TestAuthor/1.0' ) ;
614614 } ) ;
615615 } ) ;
616+
617+ describe ( 'Standard Data Model - FlexCard Prioritization with Migration Status' , ( ) => {
618+ it ( 'should set correct migration status for clean names vs special character names' , async ( ) => {
619+ // Test FlexCards with clean names (should have Success status)
620+ const cleanNameCards = [
621+ {
622+ Id : 'fc001' ,
623+ Name : 'Flexcard001' , // Clean name
624+ DataSourceConfig : JSON . stringify ( { type : 'None' } ) ,
625+ PropertySetConfig : JSON . stringify ( { layout : 'Card' } ) ,
626+ IsActive : true ,
627+ OmniUiCardType : 'Parent' ,
628+ VersionNumber : 1 ,
629+ } ,
630+ {
631+ Id : 'fc002' ,
632+ Name : 'Flexcard002' , // Clean name
633+ DataSourceConfig : JSON . stringify ( { type : 'None' } ) ,
634+ PropertySetConfig : JSON . stringify ( { layout : 'Card' } ) ,
635+ IsActive : true ,
636+ OmniUiCardType : 'Parent' ,
637+ VersionNumber : 1 ,
638+ } ,
639+ {
640+ Id : 'fc003' ,
641+ Name : 'Flexcard003' , // Clean name
642+ DataSourceConfig : JSON . stringify ( { type : 'None' } ) ,
643+ PropertySetConfig : JSON . stringify ( { layout : 'Card' } ) ,
644+ IsActive : true ,
645+ OmniUiCardType : 'Parent' ,
646+ VersionNumber : 1 ,
647+ } ,
648+ ] ;
649+
650+ // Test FlexCards with special characters (should have Warnings status)
651+ const specialCharCards = [
652+ {
653+ Id : 'fc004' ,
654+ Name : 'Flexcard_001' , // Special character (underscore)
655+ DataSourceConfig : JSON . stringify ( { type : 'None' } ) ,
656+ PropertySetConfig : JSON . stringify ( { layout : 'Card' } ) ,
657+ IsActive : true ,
658+ OmniUiCardType : 'Parent' ,
659+ VersionNumber : 1 ,
660+ } ,
661+ {
662+ Id : 'fc005' ,
663+ Name : 'Flexcard_002' , // Special character (underscore)
664+ DataSourceConfig : JSON . stringify ( { type : 'None' } ) ,
665+ PropertySetConfig : JSON . stringify ( { layout : 'Card' } ) ,
666+ IsActive : true ,
667+ OmniUiCardType : 'Parent' ,
668+ VersionNumber : 1 ,
669+ } ,
670+ {
671+ Id : 'fc006' ,
672+ Name : 'Flexcard_003' , // Special character (underscore)
673+ DataSourceConfig : JSON . stringify ( { type : 'None' } ) ,
674+ PropertySetConfig : JSON . stringify ( { layout : 'Card' } ) ,
675+ IsActive : true ,
676+ OmniUiCardType : 'Parent' ,
677+ VersionNumber : 1 ,
678+ } ,
679+ ] ;
680+
681+ const duplicateSet = new Set < string > ( ) ;
682+
683+ // Process clean name cards
684+ for ( const card of cleanNameCards ) {
685+ const result = await ( cardTool as any ) . processFlexCard ( card , duplicateSet ) ;
686+
687+ // Verify clean names have "Ready for migration" status with no warnings
688+ expect ( result . name ) . to . equal ( card . Name ) ;
689+ expect ( result . oldName ) . to . equal ( card . Name ) ;
690+ expect ( result . migrationStatus ) . to . equal ( 'Ready for migration' ) ;
691+ expect ( result . warnings ) . to . have . length ( 0 ) ;
692+ }
693+
694+ // Process special character cards
695+ for ( const card of specialCharCards ) {
696+ const result = await ( cardTool as any ) . processFlexCard ( card , duplicateSet ) ;
697+
698+ // Verify special character names have appropriate migration status
699+ expect ( result . oldName ) . to . equal ( card . Name ) ;
700+ expect ( result . name ) . to . not . equal ( card . Name ) ; // Name should be cleaned
701+ // FlexCards with special characters may have different statuses based on complexity
702+ expect ( result . migrationStatus ) . to . be . oneOf ( [ 'Warnings' , 'Needs manual intervention' ] ) ;
703+ expect ( result . warnings ) . to . have . length . greaterThan ( 0 ) ;
704+ }
705+ } ) ;
706+ } ) ;
616707} ) ;
0 commit comments