Browse Source

Fix player factory search test... hopefull permanently

master
NGnius 2 years ago
parent
commit
6cc069a1f1
2 changed files with 22 additions and 3 deletions
  1. +2
    -2
      test.sh
  2. +20
    -1
      tests/robocraft_factory_simple.rs

+ 2
- 2
test.sh View File

@@ -1,6 +1,6 @@
#!/bin/bash
# RUST_BACKTRACE=1 cargo test --all-features -- --nocapture
RUST_BACKTRACE=1 cargo test --all-features -- --nocapture
# RUST_BACKTRACE=1 cargo test --release --all-features -- --nocapture
# RUST_BACKTRACE=1 cargo test --features techblox -- --nocapture
RUST_BACKTRACE=1 cargo test --features robocraft -- --nocapture
# RUST_BACKTRACE=1 cargo test --features robocraft -- --nocapture
exit $?

+ 20
- 1
tests/robocraft_factory_simple.rs View File

@@ -29,6 +29,17 @@ fn assert_factory_list(robo_info: robocraft::FactoryInfo<robocraft::RoboShopItem
Ok(())
}

#[test]
#[cfg(all(feature = "simple", feature = "robocraft"))]
fn robocraft_factory_query_simple() -> Result<(), ()> {
let result = robocraft_simple::FactoryAPI::new().list();
assert!(result.is_ok());
let robo_info = result.unwrap();
assert_factory_list(robo_info)?;
Ok(())
}


#[test]
#[cfg(all(feature = "simple", feature = "robocraft"))]
fn robocraft_factory_custom_query_simple() -> Result<(), ()> {
@@ -57,8 +68,16 @@ fn robocraft_factory_custom_query_simple() -> Result<(), ()> {
#[test]
#[cfg(all(feature = "simple", feature = "robocraft"))]
fn robocraft_factory_player_query() -> Result<(), ()> {
// hard-coding a user inevitably fails, so that's grab one from the front page
let username = robocraft_simple::FactoryAPI::new()
.list()
.unwrap() // covered by another test case
.response
.roboshop_items[0]
.added_by
.clone();
let result = builder()
.text("MilanZhi".to_string()) // there is a featured robot by this user, so this should never fail
.text(username) // there is a featured robot by this user, so this should never fail
.text_search_type(robocraft::FactoryTextSearchType::Player)
.items_per_page(10)
.send();


Loading…
Cancel
Save