test: simplify migration status counts · openclaw/openclaw@d82cc7f
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -87,15 +87,25 @@ function codexPluginConfigItem(pluginNames: string[]): MigrationItem {
|
87 | 87 | } |
88 | 88 | |
89 | 89 | function plan(items: MigrationItem[]): MigrationPlan { |
| 90 | +const countStatus = (status: MigrationItem["status"]): number => { |
| 91 | +let count = 0; |
| 92 | +for (const item of items) { |
| 93 | +if (item.status === status) { |
| 94 | +count += 1; |
| 95 | +} |
| 96 | +} |
| 97 | +return count; |
| 98 | +}; |
| 99 | + |
90 | 100 | return { |
91 | 101 | providerId: "codex", |
92 | 102 | source: "/tmp/codex", |
93 | 103 | summary: { |
94 | 104 | total: items.length, |
95 | | -planned: items.filter((item) => item.status === "planned").length, |
| 105 | +planned: countStatus("planned"), |
96 | 106 | migrated: 0, |
97 | | -skipped: items.filter((item) => item.status === "skipped").length, |
98 | | -conflicts: items.filter((item) => item.status === "conflict").length, |
| 107 | +skipped: countStatus("skipped"), |
| 108 | +conflicts: countStatus("conflict"), |
99 | 109 | errors: 0, |
100 | 110 | sensitive: 0, |
101 | 111 | }, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。