import { createDatabaseConfig } from './database.config';

describe('createDatabaseConfig', () => {
  it('uses postgres and permanently disables synchronization', () => {
    expect(
      createDatabaseConfig('postgresql://test:test@localhost/test'),
    ).toMatchObject({
      type: 'postgres',
      url: 'postgresql://test:test@localhost/test',
      synchronize: false,
      autoLoadEntities: true,
    });
  });

  it('rejects an empty database URL', () => {
    expect(() => createDatabaseConfig('')).toThrow('DATABASE_URL is required');
  });
});
