Full UI 180 & Overall improvements
Some checks failed
Luggage List Build / build-web (push) Successful in 31s
Luggage List Build / build-android (push) Failing after 1m24s
Luggage List Build / release (push) Has been skipped

This commit is contained in:
Space-Banane
2026-04-19 00:12:16 +02:00
parent 0057290055
commit 0a8444700e
45 changed files with 9468 additions and 1390 deletions

33
src/utils/items.test.js Normal file
View File

@@ -0,0 +1,33 @@
import { resolvePlacementValue, toPlacementFormState, withPlacementCustomFallback } from './items';
describe('items helpers', () => {
test('toPlacementFormState keeps known placements as-is', () => {
expect(toPlacementFormState('suitcase')).toEqual({
placement: 'suitcase',
placementCustom: '',
});
});
test('toPlacementFormState converts custom placements to other with value', () => {
expect(toPlacementFormState('hotel safe')).toEqual({
placement: 'other',
placementCustom: 'hotel safe',
});
});
test('resolvePlacementValue returns custom value when placement is other', () => {
expect(resolvePlacementValue('other', ' hotel safe ')).toBe('hotel safe');
});
test('resolvePlacementValue returns direct placement when not other', () => {
expect(resolvePlacementValue('backpack', 'ignored')).toBe('backpack');
});
test('withPlacementCustomFallback prefers existing custom value', () => {
expect(withPlacementCustomFallback('closet shelf', 'hotel safe')).toBe('closet shelf');
});
test('withPlacementCustomFallback uses fallback when custom is empty', () => {
expect(withPlacementCustomFallback(' ', 'hotel safe')).toBe('hotel safe');
});
});