feat: v0.8.0 — player-actions API: accept/dispatch/buy/sell/refuel endpoints (tick-first, full-snapshot responses), spawn coverage rule, test create-contract hook

This commit is contained in:
2026-09-17 13:54:13 +00:00
parent 96835e935d
commit aa70eb5286
25 changed files with 1843 additions and 8 deletions
+13 -2
View File
@@ -13,12 +13,23 @@ test('GET /api/version returns the app version from package.json', async ({ page
expect(body.version).toBe(pkg.version);
});
test('GET /api/openapi serves the spec with all four endpoints and the package.json version', async ({ page }) => {
test('GET /api/openapi serves the spec with all nine endpoints and the package.json version', async ({ page }) => {
const res = await page.request.get('/api/openapi');
expect(res.status()).toBe(200);
expect(res.headers()['content-type']).toContain('application/json');
const spec = (await res.json()) as { info: { title: string; version: string }; paths: Record<string, unknown> };
expect(spec.info.title).toBe('Flight Ops API');
expect(spec.info.version).toBe(pkg.version);
expect(Object.keys(spec.paths).sort()).toEqual(['/api/airports', '/api/sim', '/api/state', '/api/version']);
// v0.8.0 adds the five player-action endpoints to the four read-only ones.
expect(Object.keys(spec.paths).sort()).toEqual([
'/api/airports',
'/api/contracts/{id}/accept',
'/api/market/buy-plane',
'/api/market/sell-plane',
'/api/planes/{planeId}/dispatch',
'/api/planes/{planeId}/refuel',
'/api/sim',
'/api/state',
'/api/version',
]);
});