import React, { version } from 'react';
import { renderToString } from 'react-dom/server';
import BackupLoading from '../BackupLoading';
import UniversalSuspense from '../UniversalSuspense';
describe('', () => {
let warnspy: jest.Spied;
beforeEach(() => {
warnspy = jest.spyOn(global.console, 'warn').mockImplementation(() => {});
});
afterEach(() => {
warnspy.mockRestore();
});
it('should warn users about missing Suspense', () => {
const tree = (
}>
hi
);
const LegacyReact = version.startsWith('16') || version.startsWith('17');
const msg = renderToString(tree);
if (LegacyReact) {
expect(msg).toBeDefined();
expect(msg).toMatchInlineSnapshot(`"hi
"`);
} else {
expect(msg).toMatchInlineSnapshot(`"hi
"`);
}
});
});