feat(api): ship + research endpoints queue tasks with lead + helpers; mission accept is instant and free (#44)
CI / build + unit + e2e (pull_request) Failing after 3m58s

This commit is contained in:
2026-10-02 18:36:14 +00:00
parent 4e312d054f
commit 03b8b661f6
20 changed files with 772 additions and 103 deletions
+23
View File
@@ -44,6 +44,23 @@ describe('OpenAPI spec', () => {
expect(post.responses[status].content['application/json'].schema.$ref).toBe('#/components/schemas/Error');
}
}
// The queued-ship-work requests: the action target plus the crew team (lead required,
// helpers optional) — the same team fields as JumpRequest / ExploreRequest.
const upgradeReq = openApiSpec.components.schemas.UpgradeRequest as { properties: Record<string, unknown>; required: string[] };
expect(Object.keys(upgradeReq.properties)).toEqual(['systemId', 'leadCrewId', 'helperCrewIds']);
expect(upgradeReq.required).toEqual(['systemId', 'leadCrewId']);
expect((upgradeReq.properties.helperCrewIds as { items: { type: string } }).items.type).toBe('integer');
const expandReq = openApiSpec.components.schemas.ExpandRequest as { properties: Record<string, unknown>; required: string[] };
expect(Object.keys(expandReq.properties)).toEqual(['systemId', 'leadCrewId', 'helperCrewIds']);
expect(expandReq.required).toEqual(['systemId', 'leadCrewId']);
expect((expandReq.properties.helperCrewIds as { items: { type: string } }).items.type).toBe('integer');
const buildReq = openApiSpec.components.schemas.BuildRequest as { properties: Record<string, unknown>; required: string[] };
expect(Object.keys(buildReq.properties)).toEqual(['type', 'leadCrewId', 'helperCrewIds']);
expect(buildReq.required).toEqual(['type', 'leadCrewId']);
expect((buildReq.properties.helperCrewIds as { items: { type: string } }).items.type).toBe('integer');
});
it('describes the tech endpoints: GET /api/tech → Tech[], POST /api/research with error responses', () => {
@@ -61,6 +78,12 @@ describe('OpenAPI spec', () => {
for (const status of ['400', '404', '409', '422'] as const) {
expect(post.responses[status].content['application/json'].schema.$ref).toBe('#/components/schemas/Error');
}
// The queued-research request: the tech target plus the crew team (lead required, helpers optional).
const researchReq = openApiSpec.components.schemas.ResearchRequest as { properties: Record<string, unknown>; required: string[] };
expect(Object.keys(researchReq.properties)).toEqual(['techId', 'leadCrewId', 'helperCrewIds']);
expect(researchReq.required).toEqual(['techId', 'leadCrewId']);
expect((researchReq.properties.helperCrewIds as { items: { type: string } }).items.type).toBe('integer');
});
it('describes the mission endpoints: GET /api/missions → Mission[], POST accept with error responses', () => {