mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	zjsunit: Handle duplicate overrides.
We want to undo overrides in reverse order, which is important if you override the same name more than once in the same function. Until today the code basically prevented us from ever using the original implementation of a name we stubbed, and most of them start as undefined due to their parent modules starting with `set_global`. But I do want this proper, and I introduced a tiny pitfall today.
This commit is contained in:
		
				
					committed by
					
						
						Steve Howell
					
				
			
			
				
	
			
			
			
						parent
						
							10bb60e13d
						
					
				
				
					commit
					0d68a23066
				
			@@ -102,6 +102,7 @@ exports.with_overrides = function (test_function) {
 | 
			
		||||
 | 
			
		||||
    test_function(override);
 | 
			
		||||
 | 
			
		||||
    restore_callbacks.reverse();
 | 
			
		||||
    for (const restore_callback of restore_callbacks) {
 | 
			
		||||
        restore_callback();
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user