Skip to content

Commit

Permalink
Fix clipboard test
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz committed Jun 9, 2022
1 parent bbbdd01 commit c7a940c
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
import clipboard from '../clipboard';

test('Set item to localStorage', () => {
const setItemSpy = jest.fn();
window.localStorage = {getItem: setItemSpy};
clipboard.set('test-key', 'test-value');

const item = {key1: 'value1', key2: 1234};
clipboard.set('test-key', item);
expect(setItemSpy).toBeCalledWith(item);
let item = null;

clipboard.observe('test-key', (value) => {
item = value;
}, true);

expect(item).toEqual('test-value');
});

0 comments on commit c7a940c

Please sign in to comment.