2025-12-16 00:01:58 +01:00
|
|
|
/**
|
|
|
|
|
* Jest Setup File for JavaScript UI Tests
|
|
|
|
|
*
|
|
|
|
|
* Sets up environment and global utilities for testing.
|
|
|
|
|
* Jest with jsdom environment already provides DOM globals.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// Add TextEncoder/TextDecoder polyfills for Node.js compatibility
|
|
|
|
|
const { TextEncoder, TextDecoder } = require('util');
|
|
|
|
|
global.TextEncoder = TextEncoder;
|
|
|
|
|
global.TextDecoder = TextDecoder;
|
|
|
|
|
|
|
|
|
|
// Mock console methods to reduce noise in tests
|
|
|
|
|
const originalLog = console.log;
|
|
|
|
|
console.log = (...args) => {
|
|
|
|
|
// Only log if DEBUG_TESTS environment variable is set
|
|
|
|
|
if (process.env.DEBUG_TESTS) {
|
|
|
|
|
originalLog(...args);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Setup DOM fixtures after page load
|
|
|
|
|
beforeEach(() => {
|
|
|
|
|
// Reset document body for each test
|
|
|
|
|
document.body.innerHTML = '<div id="content"></div>';
|
2026-10-02 22:59:33 +02:00
|
|
|
});
|