v0.64.0: market top-up + coverage spawn run on every tick including frozen ones, so a grounded fleet can never drain the market to zero (#135 follow-up)
CI / build + unit + e2e (pull_request) Successful in 14m12s
CI / build + unit + e2e (pull_request) Successful in 14m12s
This commit is contained in:
@@ -641,6 +641,24 @@ describe('grounded fleet freezes the world clock (#135)', () => {
|
||||
|
||||
expect(sim.clockMs).toBeGreaterThan(STARTING_CLOCK_MS); // the repair gate is what keeps time moving
|
||||
});
|
||||
|
||||
it('a frozen tick still tops up the market so a grounded fleet never starves (#135 follow-up)', async () => {
|
||||
const inst = await freshDb('frozen-topup.db'); // seeded starter is on the ground → frozen
|
||||
// Drain the open market to zero the way repeated ignores would (removal paths run while frozen).
|
||||
for (const p of await inst.db.select().from(schema.packages)) {
|
||||
if (p.status === 'open') {
|
||||
await inst.db.update(schema.packages).set({ status: 'ignored' }).where(eq(schema.packages.id, p.id));
|
||||
}
|
||||
}
|
||||
|
||||
vi.setSystemTime(T0 + 1_000); // a background tick while the fleet is grounded
|
||||
const sim = await tickOnce(inst);
|
||||
|
||||
expect(sim.clockMs).toBe(STARTING_CLOCK_MS); // freeze preserved…
|
||||
const openRows = (await inst.db.select().from(schema.packages)).filter((p) => p.status === 'open');
|
||||
expect(openRows.length).toBeGreaterThanOrEqual(MARKET_TARGET_OPEN_PACKAGES); // …but the market is topped back up…
|
||||
expect(openRows.some((p) => p.originIcao === 'EDDF')).toBe(true); // …including coverage for the grounded starter's airport
|
||||
});
|
||||
});
|
||||
|
||||
describe('spawnOpenPackages', () => {
|
||||
|
||||
Reference in New Issue
Block a user