@sigi/ssr
Version:
Server side rendering support for sigi framework
24 lines • 845 B
JavaScript
import { restoreState } from '../browser';
beforeEach(() => {
global.document = {};
global.window = {};
});
afterEach(() => {
delete global.document;
delete global.window;
});
describe('Browser function test', () => {
it('should add data into window', () => {
global.document.getElementById = jest.fn().mockReturnValue({ textContent: '{}' });
restoreState();
expect(global.window['SIGI_STATE']).toEqual({});
expect(global.window['SIGI_RETRY']).toEqual({});
});
it('should not add data into window', () => {
global.document.getElementById = jest.fn().mockReturnValue(null);
restoreState();
expect(global.window['SIGI_STATE']).toEqual(undefined);
expect(global.window['SIGI_RETRY']).toEqual(undefined);
});
});
//# sourceMappingURL=browser.spec.js.map