feat: add tests for normalizeName and RecipesService methods, including unit conversion and alias normalization
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { normalizeName } from './normalize-name';
|
||||
|
||||
describe('normalizeName', () => {
|
||||
it('gör om till gemener', () => {
|
||||
expect(normalizeName('Kycklingfilé')).toBe('kycklingfile');
|
||||
});
|
||||
|
||||
it('tar bort svenska diakritiska tecken', () => {
|
||||
expect(normalizeName('åäö')).toBe('aao');
|
||||
expect(normalizeName('ÅÄÖ')).toBe('aao');
|
||||
});
|
||||
|
||||
it('tar bort mellanslag', () => {
|
||||
expect(normalizeName('rökt paprikapulver')).toBe('roktpaprikapulver');
|
||||
});
|
||||
|
||||
it('tar bort inledande och avslutande mellanslag', () => {
|
||||
expect(normalizeName(' lax ')).toBe('lax');
|
||||
});
|
||||
|
||||
it('tar bort specialtecken', () => {
|
||||
expect(normalizeName('Curry (mild)')).toBe('currymild');
|
||||
});
|
||||
|
||||
it('hanterar siffror', () => {
|
||||
expect(normalizeName('Omega-3')).toBe('omega3');
|
||||
});
|
||||
|
||||
it('hanterar tom sträng', () => {
|
||||
expect(normalizeName('')).toBe('');
|
||||
});
|
||||
|
||||
it('hanterar sträng med bara mellanslag', () => {
|
||||
expect(normalizeName(' ')).toBe('');
|
||||
});
|
||||
|
||||
it('normaliserar accenter korrekt', () => {
|
||||
expect(normalizeName('Fläskfilé')).toBe('flaskfile');
|
||||
expect(normalizeName('Gräddfil')).toBe('graddfil');
|
||||
expect(normalizeName('Rödlök')).toBe('rodlok');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user