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',
    });
  });
});
