Replace #[tokio::test] w/ wasm-ok macro calls

This commit is contained in:
bitfl0wer 2023-11-22 14:39:32 +01:00
parent 0cae35e592
commit 38c95255c5
10 changed files with 56 additions and 28 deletions

View File

@ -7,7 +7,8 @@ wasm_bindgen_test_configure!(run_in_browser);
mod common;
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn test_registration() {
let bundle = common::setup().await;
let reg = RegisterSchema {

View File

@ -11,7 +11,8 @@ use wasm_bindgen_test::*;
#[cfg(target_arch = "wasm32")]
wasm_bindgen_test_configure!(run_in_browser);
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn get_channel() {
let mut bundle = common::setup().await;
let bundle_channel = bundle.channel.read().unwrap().clone();
@ -24,7 +25,8 @@ async fn get_channel() {
common::teardown(bundle).await
}
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn delete_channel() {
let mut bundle = common::setup().await;
let channel_guard = bundle.channel.write().unwrap().clone();
@ -33,7 +35,8 @@ async fn delete_channel() {
common::teardown(bundle).await
}
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn modify_channel() {
const CHANNEL_NAME: &str = "beepboop";
let mut bundle = common::setup().await;
@ -91,7 +94,8 @@ async fn modify_channel() {
common::teardown(bundle).await
}
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn get_channel_messages() {
let mut bundle = common::setup().await;
let channel_id: Snowflake = bundle.channel.read().unwrap().id;
@ -147,7 +151,8 @@ async fn get_channel_messages() {
common::teardown(bundle).await
}
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn create_dm() {
let mut bundle = common::setup().await;
let other_user = bundle.create_user("integrationtestuser2").await;

View File

@ -10,7 +10,8 @@ use wasm_bindgen_test::*;
#[cfg(target_arch = "wasm32")]
wasm_bindgen_test_configure!(run_in_browser);
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
/// Tests establishing a connection (hello and heartbeats) on the local gateway;
async fn test_gateway_establish() {
let bundle = common::setup().await;
@ -19,7 +20,8 @@ async fn test_gateway_establish() {
common::teardown(bundle).await
}
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
/// Tests establishing a connection and authenticating
async fn test_gateway_authenticate() {
let bundle = common::setup().await;
@ -33,7 +35,8 @@ async fn test_gateway_authenticate() {
common::teardown(bundle).await
}
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn test_self_updating_structs() {
let mut bundle = common::setup().await;
let received_channel = bundle
@ -66,7 +69,8 @@ async fn test_self_updating_structs() {
common::teardown(bundle).await
}
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn test_recursive_self_updating_structs() {
// Setup
let mut bundle = common::setup().await;

View File

@ -9,7 +9,8 @@ use wasm_bindgen_test::*;
#[cfg(target_arch = "wasm32")]
wasm_bindgen_test_configure!(run_in_browser);
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn guild_creation_deletion() {
let mut bundle = common::setup().await;
@ -31,7 +32,8 @@ async fn guild_creation_deletion() {
common::teardown(bundle).await
}
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn get_channels() {
let mut bundle = common::setup().await;
let guild = bundle.guild.read().unwrap().clone();
@ -39,7 +41,8 @@ async fn get_channels() {
common::teardown(bundle).await;
}
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn guild_create_ban() {
// TODO: When routes exist to check if user x is on guild y, add this as an assertion to check
// if Spacebar actually bans the user.
@ -76,7 +79,8 @@ async fn guild_create_ban() {
common::teardown(bundle).await
}
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn modify_guild() {
let mut bundle = common::setup().await;
let schema = GuildModifySchema {
@ -91,7 +95,8 @@ async fn modify_guild() {
common::teardown(bundle).await
}
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn guild_remove_member() {
let mut bundle = common::setup().await;
let channel = bundle.channel.read().unwrap().clone();

View File

@ -5,7 +5,8 @@ use wasm_bindgen_test::*;
#[cfg(target_arch = "wasm32")]
wasm_bindgen_test_configure!(run_in_browser);
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn generate_general_configuration_schema() {
let bundle = common::setup().await;
bundle

View File

@ -6,7 +6,8 @@ use wasm_bindgen_test::*;
#[cfg(target_arch = "wasm32")]
wasm_bindgen_test_configure!(run_in_browser);
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn create_accept_invite() {
let mut bundle = common::setup().await;
let channel = bundle.channel.read().unwrap().clone();

View File

@ -7,7 +7,8 @@ wasm_bindgen_test_configure!(run_in_browser);
mod common;
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn add_remove_role() -> ChorusResult<()> {
let mut bundle = common::setup().await;
let guild = bundle.guild.read().unwrap().id;

View File

@ -10,7 +10,8 @@ wasm_bindgen_test_configure!(run_in_browser);
mod common;
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn send_message() {
let mut bundle = common::setup().await;
let message = types::MessageSendSchema {
@ -22,7 +23,8 @@ async fn send_message() {
common::teardown(bundle).await
}
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn send_message_attachment() {
let f = File::open("./README.md").unwrap();
let mut reader = BufReader::new(f);
@ -59,7 +61,8 @@ async fn send_message_attachment() {
common::teardown(bundle).await
}
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn search_messages() {
let f = File::open("./README.md").unwrap();
let mut reader = BufReader::new(f);
@ -105,7 +108,8 @@ async fn search_messages() {
assert_eq!(query_result.get(0).unwrap().id, message.id);
}
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn test_stickies() {
let mut bundle = common::setup().await;
let message = types::MessageSendSchema {

View File

@ -7,7 +7,8 @@ wasm_bindgen_test_configure!(run_in_browser);
mod common;
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn test_get_mutual_relationships() {
let mut bundle = common::setup().await;
let mut other_user = bundle.create_user("integrationtestuser2").await;
@ -28,7 +29,8 @@ async fn test_get_mutual_relationships() {
common::teardown(bundle).await
}
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn test_get_relationships() {
let mut bundle = common::setup().await;
let mut other_user = bundle.create_user("integrationtestuser2").await;
@ -51,7 +53,8 @@ async fn test_get_relationships() {
common::teardown(bundle).await
}
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn test_modify_relationship_friends() {
let mut bundle = common::setup().await;
let mut other_user = bundle.create_user("integrationtestuser2").await;
@ -102,7 +105,8 @@ async fn test_modify_relationship_friends() {
common::teardown(bundle).await
}
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn test_modify_relationship_block() {
let mut bundle = common::setup().await;
let mut other_user = bundle.create_user("integrationtestuser2").await;

View File

@ -7,7 +7,8 @@ wasm_bindgen_test_configure!(run_in_browser);
mod common;
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn create_and_get_roles() {
let mut bundle = common::setup().await;
let permissions = types::PermissionFlags::CONNECT | types::PermissionFlags::MANAGE_EVENTS;
@ -36,7 +37,8 @@ async fn create_and_get_roles() {
common::teardown(bundle).await
}
#[tokio::test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
async fn get_and_delete_role() {
let mut bundle = common::setup().await;
let guild_id = bundle.guild.read().unwrap().id;