blob: 968815d4c8cbcf41042676f07ab89548a7137649 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
describe("app.services.Preferences", function(){
var Preferences = window.app.services.Preferences;
var prefs;
beforeEach( function() {
spyOn(window.localStorage, "getItem").and.returnValue( '{"foo":true}' );
spyOn(window.localStorage, "setItem");
prefs = Preferences.instance();
});
it("should return a preference from localStorage", function() {
expect( prefs.get("foo") ).toEqual( {foo:true} );
});
it("should set a preference in localStorage", function() {
prefs.set("foo", { foo: false } );
expect( window.localStorage.setItem ).toHaveBeenCalledWith('foo', '{"foo":false}');
});
});
|