Fix lifecycle simulation in script scope tests
This commit is contained in:
@@ -37,6 +37,20 @@ describe('scope options', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('editing promoted script scopes', () => {
|
describe('editing promoted script scopes', () => {
|
||||||
|
async function activateAndCompleteFiles(kind: 'beta' | 'campaign', id: number | string) {
|
||||||
|
await activateFiles(kind, id);
|
||||||
|
const { db } = await import('../../src/lib/server/db/index.js');
|
||||||
|
const { finishDeployment } = await import('../../src/lib/server/provisioning/history.js');
|
||||||
|
// These scope-edit flows simulate a completed deployment before opening
|
||||||
|
// another beta; applying files alone leaves its rebuild pending.
|
||||||
|
const operations = db()
|
||||||
|
.prepare(
|
||||||
|
'SELECT operation_id FROM provisioning_sources WHERE kind = ? AND source_id = ?'
|
||||||
|
)
|
||||||
|
.all(kind, String(id)) as { operation_id: string }[];
|
||||||
|
for (const operation of operations) finishDeployment(operation.operation_id, { ok: true });
|
||||||
|
}
|
||||||
|
|
||||||
async function saveScope(
|
async function saveScope(
|
||||||
scriptId: number,
|
scriptId: number,
|
||||||
scopeType: 'game' | 'map' | null,
|
scopeType: 'game' | 'map' | null,
|
||||||
@@ -77,13 +91,13 @@ describe('editing promoted script scopes', () => {
|
|||||||
waitForHealth: false,
|
waitForHealth: false,
|
||||||
waitForMatch: false
|
waitForMatch: false
|
||||||
});
|
});
|
||||||
await activateFiles('beta', betaId);
|
await activateAndCompleteFiles('beta', betaId);
|
||||||
db()
|
db()
|
||||||
.prepare("UPDATE beta_servers SET stage = 'ready' WHERE beta_id = ?")
|
.prepare("UPDATE beta_servers SET stage = 'ready' WHERE beta_id = ?")
|
||||||
.run(betaId);
|
.run(betaId);
|
||||||
db().prepare("UPDATE betas SET state = 'ready-promote' WHERE id = ?").run(betaId);
|
db().prepare("UPDATE betas SET state = 'ready-promote' WHERE id = ?").run(betaId);
|
||||||
const result = await promoteBeta(betaId);
|
const result = await promoteBeta(betaId);
|
||||||
await activateFiles('campaign', result.deploymentId);
|
await activateAndCompleteFiles('campaign', result.deploymentId);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
await promote();
|
await promote();
|
||||||
|
|||||||
Reference in New Issue
Block a user