diff --git a/tests/store.test.js b/tests/store.test.js index 7016a64..2e73fe8 100644 --- a/tests/store.test.js +++ b/tests/store.test.js @@ -99,3 +99,20 @@ test('Store: getSummary returns computed summary for attribute', () => { assert.equal(sum.trainsToday, 2); assert.equal(sum.perDay, Math.floor((2 / 7) * 247)); }); + +test('Store: recordTrain rejects non-positive and non-number deltas', () => { + const s = freshStore(); + assert.equal(s.recordTrain('strength', 0, NOW), false); + assert.equal(s.recordTrain('strength', -5, NOW), false); + assert.equal(s.recordTrain('strength', '10', NOW), false); + assert.equal(s.recordTrain('strength', NaN, NOW), false); + assert.equal(s.history.strength, undefined); +}); + +test('Store: getSummary on unknown attribute returns zeros', () => { + const s = freshStore(); + const sum = s.getSummary('nonexistent', NOW); + assert.equal(sum.trainsToday, 0); + assert.equal(sum.sevenDayAvgPerDay, 0); + assert.equal(sum.perDay, 0); +});