mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 19:30:44 +00:00
test: clarify legacy migration change assertions
This commit is contained in:
@@ -19,6 +19,13 @@ function migrateLegacyConfigForTest(raw: unknown): {
|
||||
: { config: next as OpenClawConfig, changes };
|
||||
}
|
||||
|
||||
function expectMigrationChangesToIncludeFragments(changes: string[], fragments: string[]): void {
|
||||
const unmatchedFragments = fragments.filter((fragment) =>
|
||||
changes.every((change) => !change.includes(fragment)),
|
||||
);
|
||||
expect({ changes, unmatchedFragments }).toMatchObject({ unmatchedFragments: [] });
|
||||
}
|
||||
|
||||
describe("legacy session maintenance migrate", () => {
|
||||
it("removes deprecated session.maintenance.rotateBytes", () => {
|
||||
const res = migrateLegacyConfigForTest({
|
||||
@@ -666,8 +673,10 @@ describe("legacy migrate controlUi.allowedOrigins seed (issue #29385)", () => {
|
||||
"http://localhost:18789",
|
||||
"http://127.0.0.1:18789",
|
||||
]);
|
||||
expect(res.changes.some((c) => c.includes("gateway.controlUi.allowedOrigins"))).toBe(true);
|
||||
expect(res.changes.some((c) => c.includes("bind=lan"))).toBe(true);
|
||||
expectMigrationChangesToIncludeFragments(res.changes, [
|
||||
"gateway.controlUi.allowedOrigins",
|
||||
"bind=lan",
|
||||
]);
|
||||
});
|
||||
|
||||
it("seeds allowedOrigins using configured port", () => {
|
||||
@@ -734,7 +743,7 @@ describe("legacy migrate controlUi.allowedOrigins seed (issue #29385)", () => {
|
||||
"http://localhost:18789",
|
||||
"http://127.0.0.1:18789",
|
||||
]);
|
||||
expect(res.changes.some((c) => c.includes("gateway.controlUi.allowedOrigins"))).toBe(true);
|
||||
expectMigrationChangesToIncludeFragments(res.changes, ["gateway.controlUi.allowedOrigins"]);
|
||||
});
|
||||
|
||||
it("does not migrate loopback bind — returns null", () => {
|
||||
|
||||
Reference in New Issue
Block a user