@@ -19,6 +19,13 @@ function migrateLegacyConfigForTest(raw: unknown): {
1919 : { config : next as OpenClawConfig , changes } ;
2020}
2121
22+ function expectMigrationChangesToIncludeFragments ( changes : string [ ] , fragments : string [ ] ) : void {
23+ const unmatchedFragments = fragments . filter ( ( fragment ) =>
24+ changes . every ( ( change ) => ! change . includes ( fragment ) ) ,
25+ ) ;
26+ expect ( { changes, unmatchedFragments } ) . toMatchObject ( { unmatchedFragments : [ ] } ) ;
27+ }
28+
2229describe ( "legacy session maintenance migrate" , ( ) => {
2330 it ( "removes deprecated session.maintenance.rotateBytes" , ( ) => {
2431 const res = migrateLegacyConfigForTest ( {
@@ -666,8 +673,10 @@ describe("legacy migrate controlUi.allowedOrigins seed (issue #29385)", () => {
666673 "http://localhost:18789" ,
667674 "http://127.0.0.1:18789" ,
668675 ] ) ;
669- expect ( res . changes . some ( ( c ) => c . includes ( "gateway.controlUi.allowedOrigins" ) ) ) . toBe ( true ) ;
670- expect ( res . changes . some ( ( c ) => c . includes ( "bind=lan" ) ) ) . toBe ( true ) ;
676+ expectMigrationChangesToIncludeFragments ( res . changes , [
677+ "gateway.controlUi.allowedOrigins" ,
678+ "bind=lan" ,
679+ ] ) ;
671680 } ) ;
672681
673682 it ( "seeds allowedOrigins using configured port" , ( ) => {
@@ -734,7 +743,7 @@ describe("legacy migrate controlUi.allowedOrigins seed (issue #29385)", () => {
734743 "http://localhost:18789" ,
735744 "http://127.0.0.1:18789" ,
736745 ] ) ;
737- expect ( res . changes . some ( ( c ) => c . includes ( "gateway.controlUi.allowedOrigins" ) ) ) . toBe ( true ) ;
746+ expectMigrationChangesToIncludeFragments ( res . changes , [ "gateway.controlUi.allowedOrigins" ] ) ;
738747 } ) ;
739748
740749 it ( "does not migrate loopback bind — returns null" , ( ) => {
0 commit comments