import { validate } from 'class-validator';
import { AuthUpdateDto } from './auth-update.dto';

describe('AuthUpdateDto help preference', () => {
  it('rejects a non-boolean helpTextsEnabled value', async () => {
    const dto = Object.assign(new AuthUpdateDto(), {
      helpTextsEnabled: 'yes',
    });

    const errors = await validate(dto);

    expect(errors.some((error) => error.property === 'helpTextsEnabled')).toBe(
      true,
    );
  });

  it('accepts a boolean helpTextsEnabled value without requiring profile fields', async () => {
    const dto = Object.assign(new AuthUpdateDto(), {
      helpTextsEnabled: false,
    });

    await expect(validate(dto)).resolves.toEqual([]);
  });
});
