Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

test(workbench): derive migration expectations from shared history (#1425)

mldangelo-oai9ffa99e5f0cf
diff --git a/plugins/codex-security/mcp-app/tests/test_workbench_database.ts b/plugins/codex-security/mcp-app/tests/test_workbench_database.ts
index 6f7b77718..dcc42877e 100644
--- a/plugins/codex-security/mcp-app/tests/test_workbench_database.ts
+++ b/plugins/codex-security/mcp-app/tests/test_workbench_database.ts
@@ -99,7 +99,7 @@ test("opens a private WAL database at the configured state path", async () => {
assert.equal(
database.prepare("SELECT COUNT(*) AS count FROM schema_migrations").get()
?.count,
- 42,
+ migrations.length,
);
assert.deepEqual(database.prepare("PRAGMA foreign_key_check").all(), []);
if (process.platform !== "win32") {
@@ -129,7 +129,7 @@ test("every released schema upgrades to the same current schema and remains idem
const current = memory(t);
applyMigrations(current);
const expected = schema(current);
- for (let version = 0; version <= 42; version++) {
+ for (const version of [0, ...migrations.map((item) => item.version)]) {
const database = memory(t, version);
applyMigrations(database);
assert.deepEqual(
@@ -243,7 +243,7 @@ test(
database
.prepare("SELECT MAX(version) AS version FROM schema_migrations")
.get()?.version,
- 42,
+ migrations.at(-1)!.version,
);
} finally {
database.close();
@@ -721,7 +721,7 @@ test("retries an upgrade when another process holds the write lock beyond the bu
database
.prepare("SELECT COUNT(*) AS count FROM schema_migrations")
.get()?.count,
- 42,
+ migrations.length,
);
assert.equal(
database.prepare("SELECT COUNT(*) AS count FROM security_targets").get()