import { describe, it, expect } from 'vitest';
import { CurrentUser } from '../decorators/current-user.decorator';

describe('CurrentUser Decorator', () => {
  it('should be defined', () => {
    expect(CurrentUser).toBeDefined();
  });

  it('should be a function (parameter decorator factory)', () => {
    // createParamDecorator returns a function
    expect(typeof CurrentUser).toBe('function');
  });

  it('extracts user from the execution context', () => {
    // The internal factory function receives (_data, ctx) and returns request.user.
    // We can access the factory via the decorator's internal metadata.
    // For NestJS param decorators, the factory is stored internally.
    // We test that the decorator is callable and produces a parameter decorator.
    const decorator = CurrentUser();
    expect(typeof decorator).toBe('function');
  });
});
