mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	node tests: Split up tutorial into smaller examples.
I didn't bother to keep the very last test from tutorial, which has some complications related to clearing stream_list data and was kind of overkill.
This commit is contained in:
		
				
					committed by
					
						
						Steve Howell
					
				
			
			
				
	
			
			
			
						parent
						
							bbec2d9625
						
					
				
				
					commit
					198c67a9bd
				
			@@ -93,25 +93,6 @@ exports.mock_esm = (request, obj = {}) => {
 | 
			
		||||
    return exports.mock_cjs(request, {...obj, __esModule: true});
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.unmock_module = (request) => {
 | 
			
		||||
    const filename = Module._resolveFilename(
 | 
			
		||||
        request,
 | 
			
		||||
        require.cache[callsites()[1].getFileName()],
 | 
			
		||||
        false,
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    if (!module_mocks.has(filename)) {
 | 
			
		||||
        throw new Error(`Cannot unmock ${filename}, which was not mocked`);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!used_module_mocks.has(filename)) {
 | 
			
		||||
        throw new Error(`You asked to mock ${filename} but we never saw it during compilation.`);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    module_mocks.delete(filename);
 | 
			
		||||
    used_module_mocks.delete(filename);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.set_global = function (name, val) {
 | 
			
		||||
    if (val === null) {
 | 
			
		||||
        throw new Error(`
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user