Update test.js
parent
e0ee1851ca
commit
7354a44bae
@ -1,12 +1,25 @@
|
||||
describe('Module: LocalStorageModule', function() {
|
||||
'use strict';
|
||||
describe('Tests functionality of the localStorage module', function(){
|
||||
beforeEach(module('LocalStorageModule'));
|
||||
var ls, store = {};
|
||||
beforeEach(inject(function(_localStorageService_){
|
||||
ls = _localStorageService_;
|
||||
|
||||
// Load the Angular module
|
||||
beforeEach(module('LocalStorageModule'));
|
||||
spyOn(ls, 'get').andCallFake(function(key){
|
||||
return store[key];
|
||||
});
|
||||
|
||||
describe('constants', function() {
|
||||
it('reads the constants', function() {
|
||||
expect(true).toBe(true);
|
||||
spyOn(ls, 'set').andCallFake(function(key, val){
|
||||
return store[key] = val + '';
|
||||
});
|
||||
|
||||
spyOn(ls, 'clearAll').andCallFake(function(){
|
||||
store = {};
|
||||
return store;
|
||||
});
|
||||
}));
|
||||
|
||||
it("Should add a value to my local storage", function(){
|
||||
ls.set('test', 'MyTest Value');
|
||||
expect(ls.get('test')).toBe('MyTest Value');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue