feat: add tests for normalizeName and RecipesService methods, including unit conversion and alias normalization

This commit is contained in:
Nils-Johan Gynther
2026-04-16 19:22:14 +02:00
parent 1b9df4d20d
commit 9292e30abc
6 changed files with 305 additions and 9 deletions
@@ -22,6 +22,13 @@ function SimpleMarkdownPreview({ text }: { text: string }) {
if (line.startsWith('# ')) return <h3 key={i} style={{ margin: '0.5rem 0 0.25rem', fontSize: '1.3em', fontWeight: 700 }}>{line.slice(2)}</h3>;
if (line.startsWith('## ')) return <h4 key={i} style={{ margin: '0.5rem 0 0.25rem', fontSize: '1.1em', fontWeight: 700 }}>{line.slice(3)}</h4>;
if (line.startsWith('- ') || line.startsWith('* ')) return <div key={i} style={{ marginLeft: '1.5rem' }}> {line.slice(2)}</div>;
const numberedMatch = line.match(/^(\d+)\.\s+(.*)/);
if (numberedMatch) return (
<div key={i} style={{ display: 'flex', gap: '0.6rem', marginBottom: '0.35rem' }}>
<span style={{ fontWeight: 700, minWidth: '1.5rem', textAlign: 'right', flexShrink: 0 }}>{numberedMatch[1]}.</span>
<span>{numberedMatch[2]}</span>
</div>
);
if (line.trim() === '') return <div key={i} style={{ height: '0.5rem' }} />;
return <div key={i}>{line}</div>;
})}