remove opine and oak deps and start adding tests
This commit is contained in:
		
							parent
							
								
									b7fee5a41f
								
							
						
					
					
						commit
						b844a053e5
					
				
					 4 changed files with 68 additions and 33 deletions
				
			
		
							
								
								
									
										55
									
								
								test/mod.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								test/mod.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,55 @@ | |||
| /* eslint-disable spaced-comment */ | ||||
| // TODO: Add tests
 | ||||
| import { Client, GatewayIntents as GI, Embed } from '../mod.ts' | ||||
| import { TOKEN } from '../src/test/config.ts' | ||||
| import { | ||||
|   assertEquals, | ||||
|   assertExists | ||||
| } from 'https://deno.land/std@0.84.0/testing/asserts.ts' | ||||
| 
 | ||||
| //#region Lib Tests
 | ||||
| Deno.test({ | ||||
|   name: '[Lib] Embed', | ||||
|   fn() { | ||||
|     const embed = new Embed() | ||||
|       .setTitle('Title') | ||||
|       .setDescription('Description') | ||||
|       .addField('F1N', 'F1V', false) | ||||
|       .addField('F2N', 'F2V', true) | ||||
|       .setColor(0xff0000) | ||||
|       .setFooter('Footer', 'https://google.com') | ||||
|       .setAuthor('Author', 'https://google.com') | ||||
| 
 | ||||
|     assertEquals( | ||||
|       JSON.stringify(embed.toJSON()), | ||||
|       `{"title":"Title","description":"Description","color":16711680,"footer":{"text":"Footer","icon_url":"https://google.com"},"author":{"name":"Author","icon_url":"https://google.com"},"fields":[{"name":"F1N","value":"F1V","inline":false},{"name":"F2N","value":"F2V","inline":true}]}` | ||||
|     ) | ||||
|   } | ||||
| }) | ||||
| 
 | ||||
| //#endregion
 | ||||
| 
 | ||||
| //#region API Tests
 | ||||
| const client = new Client({ | ||||
|   token: TOKEN, | ||||
|   intents: [GI.GUILDS, GI.GUILD_MESSAGES, GI.DIRECT_MESSAGES] | ||||
| }) | ||||
| 
 | ||||
| await client.connect() | ||||
| Deno.test({ | ||||
|   name: '[API] Client Ready', | ||||
|   fn() { | ||||
|     assertExists(client.user) | ||||
|   } | ||||
| }) | ||||
| //#endregion
 | ||||
| 
 | ||||
| Deno.test({ | ||||
|   name: '[API] Cleanup', | ||||
|   fn() { | ||||
|     setTimeout(() => { | ||||
|       client.destroy() | ||||
|       Deno.exit() | ||||
|     }, 100) | ||||
|   } | ||||
| }) | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue