Normalize conversion factor formatting

This commit is contained in:
Codex Agent
2026-03-09 19:50:26 +00:00
parent c20f2ebc60
commit b44e9e5702
5 changed files with 88 additions and 23 deletions

View File

@@ -0,0 +1,27 @@
import unittest
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
CONVERSION_RATE = (
ROOT / "hdyc-svelte" / "src" / "lib" / "utils" / "conversionRate.ts"
)
class ConversionRateTooltipFormattingTests(unittest.TestCase):
def test_conversion_rate_text_uses_formatter(self) -> None:
text = CONVERSION_RATE.read_text(encoding="utf-8")
normalized = " ".join(text.split())
self.assertIn(
"formatConversionValue(config.factor)",
normalized,
"Conversion rate helper must format the factor before inserting it into the tooltip text",
)
self.assertIn(
"formatConversionValue(config.offset ?? 0)",
normalized,
"Conversion rate tooltip must format any offset before rendering",
)
if __name__ == "__main__":
unittest.main()