refactor: retire legacy tbank-sync status and sync=observe (WealthLedger/backend#196)
This commit is contained in:
@@ -28,31 +28,11 @@ describe('OpenAPI contract (integration)', () => {
|
||||
const document = createOpenApiDocument(app);
|
||||
const schemas = document.components?.schemas;
|
||||
expect(document.paths['/api/v1/tbank-sync']).toBeUndefined();
|
||||
expect(schemas?.TbankSyncStatusDto).toBeDefined();
|
||||
for (const [model, screen] of [
|
||||
['IncomeInvestmentScreenDto', 'income'],
|
||||
['EventsInvestmentScreenDto', 'events'],
|
||||
]) {
|
||||
// eslint-disable-next-line security/detect-object-injection -- Keys come from local test fixtures or numeric iteration, not external input.
|
||||
const schema = schemas?.[model];
|
||||
assert(schema && !('$ref' in schema));
|
||||
expect(schema.required).toContain('screen');
|
||||
expect(schema.required).toContain('accountId');
|
||||
expect(schema).toMatchObject({
|
||||
properties: {
|
||||
screen: { enum: [screen] },
|
||||
from: { type: 'string', format: 'date' },
|
||||
to: { type: 'string', format: 'date' },
|
||||
},
|
||||
});
|
||||
}
|
||||
expect(schemas?.TimestampInvestmentScreenDto).toMatchObject({
|
||||
properties: {
|
||||
from: { type: 'string', format: 'date-time' },
|
||||
to: { type: 'string', format: 'date-time' },
|
||||
},
|
||||
});
|
||||
expect(schemas).not.toHaveProperty('InvestmentScreenDto');
|
||||
expect(document.paths['/api/v1/tbank-sync/{id}']).toBeUndefined();
|
||||
expect(schemas?.TbankSyncStatusDto).toBeUndefined();
|
||||
expect(schemas).not.toHaveProperty('IncomeInvestmentScreenDto');
|
||||
expect(schemas).not.toHaveProperty('EventsInvestmentScreenDto');
|
||||
expect(schemas).not.toHaveProperty('TimestampInvestmentScreenDto');
|
||||
for (const scope of ['all', '{accountId}']) {
|
||||
for (const [resource, format] of [
|
||||
['income-analytics', 'date'],
|
||||
@@ -77,6 +57,15 @@ describe('OpenAPI contract (integration)', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('does not advertise the retired observe query on investment reads', () => {
|
||||
const document = createOpenApiDocument(app);
|
||||
for (const [path, resource] of Object.entries(document.paths)) {
|
||||
if (!path.startsWith('/api/v1/')) continue;
|
||||
const parameters = resource.get?.parameters ?? [];
|
||||
expect(parameters.some((parameter) => 'name' in parameter && parameter.name === 'sync')).toBe(false);
|
||||
}
|
||||
});
|
||||
|
||||
it('exposes only the selected income dependency role and no comparison data', () => {
|
||||
const schemas = createOpenApiDocument(app).components?.schemas;
|
||||
expect(schemas?.IncomeAnalyticsResourceDto).toMatchObject({
|
||||
|
||||
Reference in New Issue
Block a user