Verschaerfe Pruefung auf ganze positive Eintragsnummern
- Fuegt isPositiveInteger() hinzu fuer Validierung von Eintragsnummern - nextEntryId und entry.entryId muessen ganze Zahlen >= 1 sein - Akzeptiert nicht mehr negative, gebrochene oder Null-Werte - Vier neue Tests pruefen die verstaerkten Anforderungen - Alle bestehenden Tests bleiben gruen Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -191,3 +191,43 @@ test('nach Sichern und Laden funktioniert Weiterarbeiten weiterhin', () => {
|
||||
assert.equal(wieder.entries.find((e) => e.entryId === zweiterEintrag.entryId), undefined);
|
||||
assert.equal(wieder.stacks.find((s) => s.id === 'B'), undefined);
|
||||
});
|
||||
|
||||
test('nextEntryId als negative Zahl liefert null', () => {
|
||||
const store = fakeStore();
|
||||
store.setItem('ram-sortierhilfe:session', JSON.stringify({
|
||||
stacks: [],
|
||||
entries: [],
|
||||
nextEntryId: -5,
|
||||
}));
|
||||
assert.equal(loadSession(store), null);
|
||||
});
|
||||
|
||||
test('nextEntryId als gebrochene Zahl liefert null', () => {
|
||||
const store = fakeStore();
|
||||
store.setItem('ram-sortierhilfe:session', JSON.stringify({
|
||||
stacks: [],
|
||||
entries: [],
|
||||
nextEntryId: 1.5,
|
||||
}));
|
||||
assert.equal(loadSession(store), null);
|
||||
});
|
||||
|
||||
test('nextEntryId als Null liefert null', () => {
|
||||
const store = fakeStore();
|
||||
store.setItem('ram-sortierhilfe:session', JSON.stringify({
|
||||
stacks: [],
|
||||
entries: [],
|
||||
nextEntryId: 0,
|
||||
}));
|
||||
assert.equal(loadSession(store), null);
|
||||
});
|
||||
|
||||
test('Eintrag mit gebrochener entryId liefert null', () => {
|
||||
const store = fakeStore();
|
||||
store.setItem('ram-sortierhilfe:session', JSON.stringify({
|
||||
stacks: [{ id: 'A', count: 1, spec: emptySpec() }],
|
||||
entries: [{ entryId: 1.5, stackId: 'A', spec: emptySpec(), source: 'barcode' }],
|
||||
nextEntryId: 2,
|
||||
}));
|
||||
assert.equal(loadSession(store), null);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user