import { afterEach, describe, expect, it, vi } from 'vitest';
import { telegramChannelLink } from './landing';

describe('telegramChannelLink', () => {
  afterEach(() => vi.unstubAllEnvs());

  it('builds the t.me link from the channel name', () => {
    vi.stubEnv('VITE_TELEGRAM_GAME_CHANNEL_NAME', '@Erudit_Game'); // a leading @ is tolerated
    expect(telegramChannelLink()).toBe('https://t.me/Erudit_Game');
  });

  it('returns null when the channel name is unset or blank', () => {
    vi.stubEnv('VITE_TELEGRAM_GAME_CHANNEL_NAME', '   ');
    expect(telegramChannelLink()).toBeNull();
  });
});
