26 lines
767 B
JavaScript
26 lines
767 B
JavaScript
|
|
/**
|
||
|
|
* 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>';
|
||
|
|
});
|