test: wire jest harness for QA gate (S1-f)

Add jest + ts-jest to the NestJS backend with an app.service smoke spec that
exercises Nest DI. `npm test` is the documented command the QA gate runs.

Trace: SRS §6 gate, NFR-8.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Brent Perteet
2026-08-20 12:53:36 -05:00
parent 9eefe50401
commit daa3407b9d
4 changed files with 3337 additions and 240 deletions

View File

@@ -0,0 +1,27 @@
import { Test, TestingModule } from '@nestjs/testing';
import { AppService } from './app.service';
// Smoke test for the QA gate (S1-f, trace: SRS §6 gate / NFR-8).
// Exercises Nest DI wiring end-to-end for a pure service so a green run proves the
// toolchain (ts-jest + @nestjs/testing) is functional. Real coverage grows from here.
describe('AppService (smoke)', () => {
let service: AppService;
beforeEach(async () => {
const moduleRef: TestingModule = await Test.createTestingModule({
providers: [AppService],
}).compile();
service = moduleRef.get<AppService>(AppService);
});
it('is resolvable from the DI container', () => {
expect(service).toBeDefined();
});
it('returns the API welcome payload', () => {
expect(service.getHello()).toEqual({
message: 'Welcome to UlHub API',
docs: 'GET /api',
});
});
});