Skip to content

Commit

Permalink
fix: set undefined value should get "undefined" (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
vst-h authored Aug 11, 2022
1 parent 3ad36fc commit 383d571
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion __tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('storage', () =>
storage.setItem(KEY, null);
expect(storage.__STORE__[KEY]).toBe('null');
storage.setItem(KEY, undefined);
expect(storage.__STORE__[KEY]).toBe('');
expect(storage.__STORE__[KEY]).toBe('undefined');
storage.setItem(KEY, {});
expect(storage.__STORE__[KEY]).toBe('[object Object]');
});
Expand Down
2 changes: 1 addition & 1 deletion src/localstorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class LocalStorage {
Object.defineProperty(this, 'setItem', {
enumerable: false,
// not mentioned in the spec, but we must always coerce to a string
value: jest.fn((key, val = '') => {
value: jest.fn((key, val) => {
this[key] = val + '';
}),
});
Expand Down

0 comments on commit 383d571

Please sign in to comment.