import { Test } from '@nestjs/testing';
import { JwtService } from '@nestjs/jwt';
import { getRepositoryToken } from '@nestjs/typeorm';
import { AuditService } from '../audit/audit.service';
import { Role } from '../users/entities/role.entity';
import { User } from '../users/entities/user.entity';
import { UsersService } from '../users/users.service';
import { AuthGuard } from './auth.guard';

describe('AuthGuard provider wiring', () => {
  it('resolves with JwtService and UsersService dependencies', async () => {
    const moduleRef = await Test.createTestingModule({
      providers: [
        AuthGuard,
        UsersService,
        {
          provide: JwtService,
          useValue: {
            verifyAsync: jest.fn(),
          },
        },
        {
          provide: getRepositoryToken(User),
          useValue: {},
        },
        {
          provide: getRepositoryToken(Role),
          useValue: {},
        },
        {
          provide: AuditService,
          useValue: {},
        },
      ],
    }).compile();

    expect(moduleRef.get(AuthGuard)).toBeDefined();
  });
});
