YES converted over local storage

This commit is contained in:
Peter Cottle 2015-04-04 11:06:23 -07:00
parent ca938ec79e
commit 3a710c8ab4
3 changed files with 59 additions and 48 deletions

View file

@ -17,6 +17,36 @@ describe('this store', function() {
expect(CommandLineStore.getCommandHistory()[0])
.toEqual(command);
var newCommand = 'echo "yo dude";';
CommandLineActions.submitCommand(newCommand);
expect(CommandLineStore.getCommandHistoryLength())
.toEqual(2);
expect(CommandLineStore.getCommandHistory()[0])
.toEqual(newCommand);
expect(CommandLineStore.getCommandHistory()[1])
.toEqual(command);
});
it('slices after max length', function() {
var maxLength = CommandLineStore.getMaxHistoryLength();
var numOver = 10;
for (var i = 0; i < maxLength + numOver; i++) {
CommandLineActions.submitCommand('commandNum' + i);
}
var numNow = 11 + numOver;
expect(
CommandLineStore.getCommandHistoryLength()
).toEqual(numNow);
expect(
CommandLineStore.getCommandHistory()[0]
).toEqual('commandNum109');
expect(
CommandLineStore.getCommandHistory()[numNow - 1]
).toEqual('commandNum89');
});
});