feature: perfection tracker for levels with best number of commands

This commit is contained in:
Patolord 2024-11-18 09:42:39 -03:00
parent 4cfaa0ae02
commit 928577b2dc
6 changed files with 53 additions and 16 deletions

View file

@ -23,7 +23,7 @@ describe('this store', function() {
expect(LevelStore.isLevelSolved(firstLevel.id))
.toEqual(false);
LevelActions.setLevelSolved(firstLevel.id);
LevelActions.setLevelSolved(firstLevel.id, false);
expect(LevelStore.isLevelSolved(firstLevel.id))
.toEqual(true);
LevelActions.resetLevelsSolved();
@ -31,4 +31,21 @@ describe('this store', function() {
.toEqual(false);
});
it('can solve a level with best status and then reset', function() {
var sequenceMap = LevelStore.getSequenceToLevels();
var firstLevel = sequenceMap[
Object.keys(sequenceMap)[0]
][0];
expect(LevelStore.isLevelBest(firstLevel.id))
.toEqual(false);
LevelActions.setLevelSolved(firstLevel.id, true);
expect(LevelStore.isLevelBest(firstLevel.id))
.toEqual(true);
LevelActions.resetLevelsSolved();
expect(LevelStore.isLevelBest(firstLevel.id))
.toEqual(false);
});
});