Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F4502039
test_timer_mutation.cjs
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
971 B
Referenced Files
None
Subscribers
None
test_timer_mutation.cjs
View Options
// Test timer list mutation during callback execution
// This tests the case where a setTimeout callback adds new timers
let results = [];
let expected = ['timer1', 'timer2', 'timer3', 'done'];
// Timer 1 fires and adds timer 2 at head of list
setTimeout(() => {
results.push('timer1');
// Add a new timer with 0ms delay - inserts at head of timer list
setTimeout(() => {
results.push('timer2');
// Add another timer from within timer2
setTimeout(() => {
results.push('timer3');
}, 0);
}, 0);
}, 10);
// Final check after all timers should have fired
setTimeout(() => {
results.push('done');
const passed = JSON.stringify(results) === JSON.stringify(expected);
console.log('Results:', JSON.stringify(results));
console.log('Expected:', JSON.stringify(expected));
console.log('Test:', passed ? 'PASSED' : 'FAILED');
if (!passed) {
process.exit(1);
}
}, 100);
console.log('Timer mutation test started...');
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, May 3, 8:57 AM (6 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
536889
Default Alt Text
test_timer_mutation.cjs (971 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment