Added a first test to see whether a card is available

This commit is contained in:
2025-01-31 23:31:58 +00:00
parent 9771a905ff
commit 871d2af2da
2 changed files with 150 additions and 13 deletions

View File

@@ -2,6 +2,7 @@ use serde::Deserialize;
// Info from here:
// https://scryfall.com/docs/api/cards
#[allow(dead_code)]
#[derive(Deserialize)]
struct ScryfallCard {
// Core Card Fields
@@ -28,8 +29,8 @@ struct ScryfallCard {
}
// https://scryfall.com/docs/api/cards#card-face-objects
#[allow(dead_code)]
#[derive(Deserialize)]
struct ScryfallCardFaceObject {
pub artist: Option<String>,
@@ -43,6 +44,7 @@ struct ScryfallCardFaceObject {
}
// https://scryfall.com/docs/api/cards#related-card-objects
#[allow(dead_code)]
#[derive(Deserialize)]
struct ScryfallRelatedCardObject {
pub id: String, // UUID
@@ -63,22 +65,15 @@ enum Colour {
Colourless
}
pub fn deserialise_card(data: String) -> Card {
Card
}
pub fn add(left: usize, right: usize) -> usize {
left + right
}
#[cfg(test)]
mod tests {
use super::*;
use std::path::PathBuf;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
fn deserialise_nissa() {
let mut d = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
d.push("test_files/nissa.json");
assert!(d.exists());
}
}