add tests localStorage
This commit is contained in:
parent
5db7695d89
commit
fccc970146
2 changed files with 23 additions and 2 deletions
|
|
@ -8,6 +8,7 @@ describe('local storage plugin', function() {
|
|||
beforeEach(function() {
|
||||
storageMock = {};
|
||||
storageMock.getItem = sinon.stub().returns(VALUE);
|
||||
storageMock.createItem = sinon.stub().returns();
|
||||
storageMock.setItem = sinon.stub().returns();
|
||||
storageMock.removeItem = sinon.stub().returns();
|
||||
storageMock.clear = sinon.stub().returns();
|
||||
|
|
@ -25,6 +26,22 @@ describe('local storage plugin', function() {
|
|||
});
|
||||
});
|
||||
|
||||
it('#createItem', function(done) {
|
||||
storageMock.getItem = sinon.stub().returns(null);
|
||||
storage.createItem('hola', 'value', function(err) {
|
||||
assert(!err);
|
||||
return done();
|
||||
});
|
||||
});
|
||||
|
||||
it('#createItem (Exists)', function(done) {
|
||||
storage.createItem('hola', 'value', function(err) {
|
||||
err.should.contain('EEXISTS');
|
||||
return done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
it('#removeItem', function(done) {
|
||||
storage.removeItem('pepe', function(err) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue