Skip to content

Commit

Permalink
Add playtest cards
Browse files Browse the repository at this point in the history
  • Loading branch information
mendess committed Aug 18, 2024
1 parent 315cc22 commit 1d19c07
Show file tree
Hide file tree
Showing 9 changed files with 247 additions and 346 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "scryfall"
version = "0.17.2"
version = "0.17.3"
authors = ["Mendess2526 <[email protected]>"]
edition = "2021"
description = "A wrapper around the scryfall magic the gathering api"
Expand Down
56 changes: 15 additions & 41 deletions src/bulk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,68 +219,42 @@ pub async fn rulings() -> crate::Result<impl Iterator<Item = crate::Result<Rulin
#[cfg(test)]
mod tests {

#[test]
#[tokio::test]
#[ignore]
fn oracle_cards() {
let rt = tokio::runtime::Runtime::new().unwrap();
let handle = rt.handle();

for card in handle
.block_on(super::oracle_cards())
.expect("Couldn't get the bulk object")
{
async fn oracle_cards() {
for card in super::oracle_cards().await.unwrap() {
card.unwrap();
}
}

#[test]
#[tokio::test]
#[ignore]
fn unique_artwork() {
let rt = tokio::runtime::Runtime::new().unwrap();
let handle = rt.handle();
for card in handle
.block_on(super::unique_artwork())
.expect("Couldn't get the bulk object")
{
async fn unique_artwork() {
for card in super::unique_artwork().await.unwrap() {
card.unwrap();
}
}

#[test]
#[tokio::test]
#[ignore]
fn default_cards() {
let rt = tokio::runtime::Runtime::new().unwrap();
let handle = rt.handle();
for card in handle
.block_on(super::default_cards())
.expect("Couldn't get the bulk object")
{
async fn default_cards() {
for card in super::default_cards().await.unwrap() {
card.unwrap();
}
}

#[test]
#[tokio::test]
#[ignore]
fn all_cards() {
let rt = tokio::runtime::Runtime::new().unwrap();
let handle = rt.handle();
for card in handle
.block_on(super::all_cards())
.expect("Couldn't get the bulk object")
{
async fn all_cards() {
for card in super::all_cards().await.unwrap() {
card.unwrap();
}
}

#[test]
#[tokio::test]
#[ignore]
fn rulings() {
let rt = tokio::runtime::Runtime::new().unwrap();
let handle = rt.handle();
for ruling in handle
.block_on(super::rulings())
.expect("Couldn't get the bulk object")
{
async fn rulings() {
for ruling in super::rulings().await.unwrap() {
ruling.unwrap();
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/card/promo_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub enum PromoType {
Plastic,
Playerrewards,
Playpromo,
Playtest,
Portrait,
Poster,
Premiereshop,
Expand All @@ -79,6 +80,8 @@ pub enum PromoType {
Themepack,
Thick,
Tourney,
UpsideDown,
UpsideDownBack,
Vault,
Wizardsplaynetwork,
}
120 changes: 52 additions & 68 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,83 +110,67 @@ mod tests {
assert_eq!(new_instance, instance)
}

#[test]
#[tokio::test]
#[ignore]
fn all_sets() {
let runtime = tokio::runtime::Runtime::new().unwrap();
let handle = runtime.handle();
handle.block_on(async move {
Set::all()
.await
.unwrap()
.into_stream()
.map(Result::unwrap)
.for_each(|set| async move {
assert!(set.code.get().len() >= 3);
})
.await
});
async fn all_sets() {
Set::all()
.await
.unwrap()
.into_stream()
.map(Result::unwrap)
.for_each(|set| async move {
assert!(set.code.get().len() >= 3);
})
.await;
}

#[test]
#[tokio::test]
#[ignore]
fn all_sets_buffered() {
let runtime = tokio::runtime::Runtime::new().unwrap();
let handle = runtime.handle();
handle.block_on(async move {
Set::all()
.await
.unwrap()
.into_stream_buffered(10)
.map(Result::unwrap)
.for_each(|set| async move {
assert!(set.code.get().len() >= 3);
})
.await
});
async fn all_sets_buffered() {
Set::all()
.await
.unwrap()
.into_stream_buffered(10)
.map(Result::unwrap)
.for_each(|set| async move {
assert!(set.code.get().len() >= 3);
})
.await;
}

#[test]
#[tokio::test]
#[ignore]
fn latest_cards() {
let runtime = tokio::runtime::Runtime::new().unwrap();
let handle = runtime.handle();
handle.block_on(async move {
Set::all()
.await
.unwrap()
.into_stream()
.map(Result::unwrap)
.take(30)
.for_each_concurrent(None, |s| async move {
let set_cards = set(s.code).search().await;
if let Err(e) = set_cards {
println!("Could not search for cards in '{}' - {}", s.name, e);
}
})
.await
})
async fn latest_cards() {
Set::all()
.await
.unwrap()
.into_stream()
.map(Result::unwrap)
.take(30)
.for_each_concurrent(None, |s| async move {
let set_cards = set(s.code).search().await;
if let Err(e) = set_cards {
println!("Could not search for cards in '{}' - {}", s.name, e);
}
})
.await;
}

#[test]
#[tokio::test]
#[ignore]
fn latest_cards_buffered() {
let runtime = tokio::runtime::Runtime::new().unwrap();
let handle = runtime.handle();
handle.block_on(async move {
Set::all()
.await
.unwrap()
.into_stream_buffered(10)
.map(Result::unwrap)
.take(30)
.for_each_concurrent(None, |s| async move {
let set_cards = set(s.code).search().await;
if let Err(e) = set_cards {
println!("Could not search for cards in '{}' - {}", s.name, e);
}
})
.await
})
async fn latest_cards_buffered() {
Set::all()
.await
.unwrap()
.into_stream_buffered(10)
.map(Result::unwrap)
.take(30)
.for_each_concurrent(None, |s| async move {
let set_cards = set(s.code).search().await;
if let Err(e) = set_cards {
println!("Could not search for cards in '{}' - {}", s.name, e);
}
})
.await;
}
}
6 changes: 3 additions & 3 deletions src/ruling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ impl Ruling {
/// .unwrap()
/// .into_stream()
/// .map(Result::unwrap)
/// .any(|r| future::ready(r.comment == "Yes, your opponent cant even. We know."))
/// .await
/// .any(|r| future::ready(dbg!(dbg!(r.comment) == "Yes, your opponent can't even. We know.")))
/// .await,
/// );
/// # })
/// ```
Expand All @@ -245,7 +245,7 @@ impl Ruling {
/// .unwrap()
/// .into_stream_buffered(10)
/// .map(Result::unwrap)
/// .any(|r| future::ready(r.comment == "Yes, your opponent cant even. We know."))
/// .any(|r| future::ready(r.comment == "Yes, your opponent can't even. We know."))
/// .await
/// );
/// # })
Expand Down
Loading

0 comments on commit 1d19c07

Please sign in to comment.