mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-27 10:01:37 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			27 lines
		
	
	
		
			780 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			780 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import handleParens from "../../src/services/search/services/handle_parens.js";
 | |
| import { TokenStructure } from "../../src/services/search/services/types.js";
 | |
| 
 | |
| describe("Parens handler", () => {
 | |
|     it("handles parens", () => {
 | |
|         const input = ["(", "hello", ")", "and", "(", "(", "pick", "one", ")", "and", "another", ")"]
 | |
|             .map(token => ({token}));
 | |
| 
 | |
|         const actual: TokenStructure = [
 | |
|             [
 | |
|                 {token: "hello"}
 | |
|             ],
 | |
|             {token: "and"},
 | |
|             [
 | |
|                 [
 | |
|                     {token: "pick"},
 | |
|                     {token: "one"}
 | |
|                 ],
 | |
|                 {token: "and"},
 | |
|                 {token: "another"}
 | |
|             ]
 | |
|         ];
 | |
| 
 | |
|         expect(handleParens(input)).toEqual(actual);
 | |
|     });
 | |
| });
 | 
