add test (fails at the moment)
This commit is contained in:
		
							parent
							
								
									58ad6fcd3d
								
							
						
					
					
						commit
						1c25e2d3a1
					
				
					 1 changed files with 30 additions and 0 deletions
				
			
		
							
								
								
									
										30
									
								
								test/argsparser_test.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								test/argsparser_test.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,30 @@ | |||
| import { parseArgs, Args } from "../src/utils/command.ts"; | ||||
| import { assertEquals } from "https://deno.land/std@0.95.0/testing/asserts.ts" | ||||
| 
 | ||||
| const commandArgs: Args[] = [{ | ||||
|     name: "permaban", | ||||
|     match: "flag", | ||||
|     flag: "--permanent", | ||||
|   }, { | ||||
|     name: "user", | ||||
|     match: "mention", | ||||
|   }, { | ||||
|     name: "reason", | ||||
|     match: "rest", | ||||
|   }]; | ||||
| const messageArgs: string[] = ["<@!708544768342229012>","--permanent","bye","bye","Skyler"]; | ||||
| const expectedResult = { | ||||
|   permaban: true, | ||||
|   user: "708544768342229012", | ||||
|   reason: ["bye","bye","Skyler"] | ||||
| } | ||||
| Deno.test({ | ||||
|   name: "parse Args", | ||||
|   fn: () => { | ||||
|     const result = parseArgs(commandArgs,messageArgs); | ||||
|     assertEquals(result, expectedResult) | ||||
|   }, | ||||
|   sanitizeOps: true, | ||||
|   sanitizeResources: true, | ||||
|   sanitizeExit: true, | ||||
| }) | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue