Skip to content

Commit

Permalink
Add test for pre-extisting value with unescaped characters
Browse files Browse the repository at this point in the history
  • Loading branch information
stropitek committed Feb 24, 2016
1 parent fb0772e commit a1f6662
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lockr.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions specs/lockrSpecs.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,21 @@ describe('Lockr.get', function () {
expect(contents).toContain([2, 3]);
});

describe('with wrong data', function() {
describe('with pre-existing data', function() {
beforeEach(function() {
localStorage.setItem('wrong', ',fluffy,truffly,commas,hell');
localStorage.setItem('unescaped', 'a " double-quote');
});

it('cleans wrong data', function () {
it("if it's not a json we get as-is", function () {
var wrongData = Lockr.get("wrong");

expect(wrongData).toBe(',fluffy,truffly,commas,hell');
});

it('works with unescaped characters', function () {
var unescaped = Lockr.get('unescaped');
expect(unescaped).toBe('a " double-quote');
});
});
});

Expand Down

0 comments on commit a1f6662

Please sign in to comment.