Skip to content

Commit

Permalink
chore: Un-skip modal in ssr tests (#3151)
Browse files Browse the repository at this point in the history
  • Loading branch information
just-boris authored Jan 3, 2025
1 parent dd1ae7e commit 46c5afd
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/__tests__/functional-tests/ssr.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ import { renderToStaticMarkup } from 'react-dom/server';
import { getRequiredPropsForComponent } from '../required-props-for-components';
import { getAllComponents, requireComponent } from '../utils';

const skipComponents = [
'modal', // it uses portal API which does not work on server
];
const allComponents = getAllComponents().filter(component => !skipComponents.includes(component));

test('ensure is it not DOM', () => {
expect(typeof window).toBe('undefined');
expect(typeof CSS).toBe('undefined');
});

for (const componentName of allComponents) {
for (const componentName of getAllComponents()) {
test(`renders ${componentName} without crashing`, () => {
const { default: Component } = requireComponent(componentName);
const props = getRequiredPropsForComponent(componentName);
const content = renderToStaticMarkup(React.createElement(Component, props, 'test content'));
expect(content.length).toBeGreaterThan(0);
if (componentName === 'modal') {
// modal uses portal API which does not work on server and returns an empty content
expect(content.length).toEqual(0);
} else {
expect(content.length).toBeGreaterThan(0);
}
});
}

0 comments on commit 46c5afd

Please sign in to comment.