import assert from 'node:assert/strict'; import { readFileSync } from 'node:fs'; import { resolve } from 'node:path'; 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'; test('F5 AssetMasterModule keeps dossier-only function dependency injectable without reopening its controller', () => { const providers = (Reflect.getMetadata(MODULE_METADATA.PROVIDERS, AssetMasterModule) ?? []) as unknown[]; const controllers = (Reflect.getMetadata(MODULE_METADATA.CONTROLLERS, AssetMasterModule) ?? []) as Array<{ name?: string }>; const dossierSource = readFileSync( resolve(process.cwd(), 'src/asset-master/merged-inventory-dossier.service.ts'), 'utf8', ); assert.match( dossierSource, /private readonly functions: InventoryFunctionService/, 'MergedInventoryDossierService must still depend on InventoryFunctionService for historical dossier data', ); assert.ok( providers.includes(InventoryFunctionService), 'AssetMasterModule must provide InventoryFunctionService so production Nest bootstrap can resolve the dossier', ); assert.equal( controllers.some((controller) => controller?.name === 'InventoryFunctionController'), false, 'F5 must not reopen the retired Inventory Function controller', ); });