From 3ffb124cd4a04c40c2fcb0bc08f6e05360dd0a2c Mon Sep 17 00:00:00 2001 From: bitfl0wer Date: Wed, 24 Jan 2024 12:32:08 +0100 Subject: [PATCH] Add test for get_limit_config --- tests/ratelimit.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/ratelimit.rs b/tests/ratelimit.rs index f9498d7..922857b 100644 --- a/tests/ratelimit.rs +++ b/tests/ratelimit.rs @@ -1,4 +1,5 @@ use chorus::errors::ChorusError; +use chorus::ratelimiter::ChorusRequest; mod common; @@ -21,3 +22,26 @@ async fn hit_ratelimit() { common::teardown(bundle).await; panic!("Ratelimit never triggered"); } + +#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)] +#[cfg_attr(not(target_arch = "wasm32"), tokio::test)] +async fn get_limit_config() { + let conf = ChorusRequest::get_limits_config("http://localhost:3001/api") + .await + .unwrap(); + assert!(conf.channel.max_pins > 0); + assert!(conf.channel.max_topic > 0); + assert!(conf.channel.max_webhooks > 0); + assert!(conf.guild.max_roles > 0); + assert!(conf.guild.max_channels > 0); + assert!(conf.guild.max_emojis > 0); + assert!(conf.guild.max_channels_in_category > 0); + assert!(conf.guild.max_members > 0); + assert!(conf.message.max_attachment_size > 0); + assert!(conf.message.max_bulk_delete > 0); + assert!(conf.message.max_reactions > 0); + assert!(conf.message.max_characters > 0); + assert!(conf.message.max_tts_characters == 0); + assert!(conf.user.max_guilds > 0); + assert!(conf.user.max_friends > 0); +}