Skip to content

Instantly share code, notes, and snippets.

@crisperpo
Created July 3, 2019 19:32
Show Gist options
  • Save crisperpo/0a191c32fb924c7f4a81233340478313 to your computer and use it in GitHub Desktop.
Save crisperpo/0a191c32fb924c7f4a81233340478313 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/qojapeg
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<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></body>
</html>
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