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:
27
backend/src/app.service.spec.ts
Normal file
27
backend/src/app.service.spec.ts
Normal 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',
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user