fix(web): harden spa foundation

refs #95
This commit is contained in:
2026-07-02 18:36:56 +02:00
parent 032b9d8116
commit 97b6c4bee7
10 changed files with 213 additions and 190 deletions
@@ -0,0 +1,47 @@
import { describe, expect, it } from 'vitest';
import { generateTypes } from './generate-openapi-types.mjs';
describe('generate-openapi-types', () => {
it('emits only schemas and ignores non-operation path item keys', () => {
const output = generateTypes({
components: {
schemas: {
ProblemDetails: {
properties: {
detail: { type: 'string' }
},
type: 'object'
}
}
},
paths: {
'/api/items/{id}': {
parameters: [
{
in: 'path',
name: 'id',
schema: { type: 'integer' }
}
],
get: {
operationId: 'GetItem',
responses: {
200: {
content: {
'application/json': {
schema: { $ref: '#/components/schemas/ProblemDetails' }
}
}
}
}
}
}
}
});
expect(output).toContain('export interface components');
expect(output).toContain('"ProblemDetails"');
expect(output).not.toContain('export interface operations');
expect(output).not.toContain('"parameters"');
});
});