| 
									
										
										
										
											2022-01-11 07:27:42 +08:00
										 |  |  | "use strict"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const ContextModule = require("../lib/ContextModule"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | describe("contextModule", () => { | 
					
						
							|  |  |  | 	let contextModule; | 
					
						
							|  |  |  | 	let request; | 
					
						
							|  |  |  | 	beforeEach(() => { | 
					
						
							|  |  |  | 		request = "/some/request"; | 
					
						
							|  |  |  | 	}); | 
					
						
							|  |  |  | 	describe("#identifier", () => { | 
					
						
							|  |  |  | 		it("returns an safe identifier for this module", () => { | 
					
						
							|  |  |  | 			contextModule = new ContextModule(() => {}, { | 
					
						
							|  |  |  | 				type: "javascript/auto", | 
					
						
							|  |  |  | 				request, | 
					
						
							| 
									
										
										
										
											2022-02-21 16:58:44 +08:00
										 |  |  | 				resource: "a", | 
					
						
							| 
									
										
										
										
											2022-01-11 07:27:42 +08:00
										 |  |  | 				mode: "lazy", | 
					
						
							|  |  |  | 				regExp: /a|b/ | 
					
						
							|  |  |  | 			}); | 
					
						
							| 
									
										
										
										
											2022-02-21 16:58:44 +08:00
										 |  |  | 			expect(contextModule.identifier()).toEqual( | 
					
						
							|  |  |  | 				expect.stringContaining("/a%7Cb/") | 
					
						
							|  |  |  | 			); | 
					
						
							| 
									
										
										
										
											2022-01-11 07:27:42 +08:00
										 |  |  | 		}); | 
					
						
							|  |  |  | 	}); | 
					
						
							|  |  |  | }); |