|
2 | 2 | import fs from "node:fs/promises"; |
3 | 3 | import os from "node:os"; |
4 | 4 | import path from "node:path"; |
| 5 | +import { expectDefined } from "@openclaw/normalization-core"; |
5 | 6 | import { |
6 | 7 | createPluginStateKeyedStoreForTests, |
7 | 8 | resetPluginStateStoreForTests, |
@@ -89,7 +90,7 @@ describe("acpx doctor state migration", () => { |
89 | 90 | "utf8", |
90 | 91 | ); |
91 | 92 |
|
92 | | - const migration = stateMigrations[0]; |
| 93 | + const migration = expectDefined(stateMigrations[0], "ACPX state migration"); |
93 | 94 | await expect(migration.detectLegacyState(migrationParams())).resolves.toMatchObject({ |
94 | 95 | preview: [ |
95 | 96 | expect.stringContaining("ACPX gateway instance id"), |
@@ -154,7 +155,7 @@ describe("acpx doctor state migration", () => { |
154 | 155 | "utf8", |
155 | 156 | ); |
156 | 157 |
|
157 | | - const migration = stateMigrations[0]; |
| 158 | + const migration = expectDefined(stateMigrations[0], "ACPX state migration"); |
158 | 159 |
|
159 | 160 | await expect(migration.detectLegacyState(migrationParams())).resolves.toBeNull(); |
160 | 161 | await expect(migration.migrateLegacyState(migrationParams())).resolves.toEqual({ |
@@ -212,7 +213,10 @@ describe("acpx doctor state migration", () => { |
212 | 213 | state: "open", |
213 | 214 | }); |
214 | 215 |
|
215 | | - const result = await stateMigrations[0].migrateLegacyState(migrationParams()); |
| 216 | + const result = await expectDefined( |
| 217 | + stateMigrations[0], |
| 218 | + "ACPX state migration", |
| 219 | + ).migrateLegacyState(migrationParams()); |
216 | 220 |
|
217 | 221 | expect(result.changes).toEqual([]); |
218 | 222 | expect(result.warnings).toEqual([ |
@@ -254,7 +258,10 @@ describe("acpx doctor state migration", () => { |
254 | 258 | createdAt: 2, |
255 | 259 | }); |
256 | 260 |
|
257 | | - const result = await stateMigrations[0].migrateLegacyState(migrationParams()); |
| 261 | + const result = await expectDefined( |
| 262 | + stateMigrations[0], |
| 263 | + "ACPX state migration", |
| 264 | + ).migrateLegacyState(migrationParams()); |
258 | 265 |
|
259 | 266 | expect(result.warnings).toEqual([]); |
260 | 267 | expect(result.changes).toEqual([ |
|
0 commit comments