fix: simplify DeckGLContainer mock to avoid ESLint require() errors

Replaced complex React.forwardRef mock with simple string mock to resolve:
- "Unexpected require()" (global-require)
- "Require statement not part of import statement" (@typescript-eslint/no-var-requires)

The simplified mock as 'div' is sufficient for integration tests focused on legend functionality.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Joe Li
2025-09-12 14:35:38 -07:00
parent 902ed7be88
commit 2dde5402ca

View File

@@ -49,19 +49,10 @@ jest.mock('@superset-ui/core', () => ({
},
}));
// Mock the heavy dependencies that cause test issues
jest.mock('./DeckGLContainer', () => {
const mockReact = require('react');
return {
DeckGLContainerStyledWrapper: mockReact.forwardRef((props: any, ref: any) =>
mockReact.createElement('div', {
'data-testid': 'deck-gl-container',
...props,
ref,
}),
),
};
});
// Mock the heavy dependencies that cause test issues
jest.mock('./DeckGLContainer', () => ({
DeckGLContainerStyledWrapper: 'div',
}));
jest.mock('./utils/colors', () => ({
hexToRGB: jest.fn(() => [255, 0, 0, 255]),