From 46c5afd6d80f0ab693313009f0a07bc1a3d7f602 Mon Sep 17 00:00:00 2001 From: Boris Serdiuk Date: Fri, 3 Jan 2025 23:02:02 +0100 Subject: [PATCH] chore: Un-skip modal in ssr tests (#3151) --- src/__tests__/functional-tests/ssr.test.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/__tests__/functional-tests/ssr.test.ts b/src/__tests__/functional-tests/ssr.test.ts index 38a531b0e6..4f514479c8 100644 --- a/src/__tests__/functional-tests/ssr.test.ts +++ b/src/__tests__/functional-tests/ssr.test.ts @@ -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); + } }); }