Skip to content

Instantly share code, notes, and snippets.

@crisperpo
Created July 3, 2019 19:32
Show Gist options
  • Save crisperpo/c30322452a897e34fb1585896ae432d5 to your computer and use it in GitHub Desktop.
Save crisperpo/c30322452a897e34fb1585896ae432d5 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/qojapeg
<script id="jsbin-javascript">
describe('SSO UserVoice token', () => {
it('Gets token from endpoint and set up consent in local storage', done => {
const wrapper = shallow(<ConsentUserVoice />);
jest.spyOn(window.localStorage.__proto__, 'getItem');
window.localStorage.__proto__.getItem = jest.fn();
jest.spyOn(window.localStorage.__proto__, 'setItem');
window.localStorage.__proto__.setItem = jest.fn();
setTimeout(() => {
wrapper.update();
expect(localStorage.setItem).toHaveBeenCalled();
done();
});
});
});
</script>
<script id="jsbin-source-javascript" type="text/javascript">describe('SSO UserVoice token', () => {
it('Gets token from endpoint and set up consent in local storage', done => {
const wrapper = shallow(<ConsentUserVoice />);
jest.spyOn(window.localStorage.__proto__, 'getItem');
window.localStorage.__proto__.getItem = jest.fn();
jest.spyOn(window.localStorage.__proto__, 'setItem');
window.localStorage.__proto__.setItem = jest.fn();
setTimeout(() => {
wrapper.update();
expect(localStorage.setItem).toHaveBeenCalled();
done();
});
});
});</script>
describe('SSO UserVoice token', () => {
it('Gets token from endpoint and set up consent in local storage', done => {
const wrapper = shallow(<ConsentUserVoice />);
jest.spyOn(window.localStorage.__proto__, 'getItem');
window.localStorage.__proto__.getItem = jest.fn();
jest.spyOn(window.localStorage.__proto__, 'setItem');
window.localStorage.__proto__.setItem = jest.fn();
setTimeout(() => {
wrapper.update();
expect(localStorage.setItem).toHaveBeenCalled();
done();
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment