Service-level probe
Scope: when the thing under test is a service method, not an HTTP route — exercise it against the real database without mocks. Boots a Nest application context: no HTTP listener, no guards.
Source-checked against optolink-backend @ 29f8589, 2026-10-06 (
tsconfig.jsonsetsoutDir: ./distwith norootDir, so the build nests underdist/src/…— confirmed against the checked-in build layout;EntitlementsServicelives atsrc/entitlements/entitlements.service.ts). The probe pattern itself is recorded 2026-08-16; re-verify live on next use.
cd optolink-backend && pnpm build # needs dist/
# NOTE: build output is nested — import from ./dist/src/app.module, NOT
# ./dist/app.module (bit us in P7-003; the example below uses process.cwd()
# because relative ./ requires don't resolve from ts-node -e).
npx ts-node -e '
const { NestFactory } = require("@nestjs/core");
const { AppModule } = require(process.cwd() + "/dist/src/app.module");
const { EntitlementsService } = require(process.cwd() + "/dist/src/entitlements/entitlements.service");
(async () => {
const app = await NestFactory.createApplicationContext(AppModule, { logger:["error"] });
const ent = app.get(EntitlementsService);
try { console.log("OK", JSON.stringify(await ent.checkQuota(process.argv[1], "links"))); }
catch (e) { console.log("THREW status="+e.getStatus(), JSON.stringify(e.getResponse())); }
await app.close();
})();' "<org-uuid>"
Swap the service/module imports for whatever's under test (e.g.
SubscriptionService, or PrismaService directly for raw seeding).