Files
dh-inspeccion-v2/api-v3/test/unit/f5-runtime-di-contract.test.ts
T

21 lines
1.1 KiB
TypeScript

import assert from 'node:assert/strict';
import test from 'node:test';
import { MODULE_METADATA } from '@nestjs/common/constants';
import { AssetMasterModule } from '../../src/asset-master/asset-master.module';
import { InventoryFunctionService } from '../../src/asset-master/inventory-function.service';
import { MergedInventoryDossierService } from '../../src/asset-master/merged-inventory-dossier.service';
test('F5 AssetMasterModule keeps dossier-only function dependency injectable', () => {
const providers = (Reflect.getMetadata(MODULE_METADATA.PROVIDERS, AssetMasterModule) ?? []) as unknown[];
const dossierDependencies = (Reflect.getMetadata('design:paramtypes', MergedInventoryDossierService) ?? []) as unknown[];
assert.ok(
dossierDependencies.includes(InventoryFunctionService),
'MergedInventoryDossierService must still declare InventoryFunctionService for historical dossier data',
);
assert.ok(
providers.includes(InventoryFunctionService),
'AssetMasterModule must provide InventoryFunctionService so production Nest bootstrap can resolve the dossier',
);
});