function assert(condition: unknown, message = "assertion failed"): void {
  if (!condition) throw new Error(message);
}

import { renderToStaticMarkup } from "react-dom/server";
import MetricCard from "../src/components/MetricCard";
import { PlatformLanguageProvider } from "../src/i18n/LanguageContext";

const translatedMarkup = renderToStaticMarkup(
  <PlatformLanguageProvider>
    <MetricCard
      label="i18n:govoplan-core.installed_modules.32b3e799"
      value="i18n:govoplan-core.core_only.d46ce7d9"
      detail="i18n:govoplan-core.install_the_campaign_module_to_show_campaign_act.3085f23e"
      tone="info"
    />
  </PlatformLanguageProvider>
);

assert(translatedMarkup.includes('class="metric-card metric-info"'), "the visual tone is preserved");
assert(translatedMarkup.includes('class="metric-label">Installed modules</div>'), "the label is translated");
assert(translatedMarkup.includes('class="metric-value">Core only</div>'), "a string value is translated");
assert(!translatedMarkup.includes("i18n:govoplan-core."), "translation keys never leak into visible card text");

const numericMarkup = renderToStaticMarkup(<MetricCard label="Count" value={7} />);
assert(numericMarkup.includes('class="metric-value">7</div>'), "numeric values are preserved");
