wikidata/tests/entity-from-json.rs
Dashiell Stander e9cd90efff Added new field on Entity struct that has the ID on it
Co-authored-by: Smittyvb <me@smitop.com>
2021-07-27 10:46:34 -04:00

39 lines
1 KiB
Rust

use wikidata::*;
#[test]
fn simple_item() {
let j: serde_json::Value =
serde_json::from_str(include_str!("../items/Q106975887.json")).unwrap();
Entity::from_json(j).unwrap();
}
#[test]
fn douglas_adams() {
let j: serde_json::Value = serde_json::from_str(include_str!("../items/Q42.json")).unwrap();
let e = Entity::from_json(j).unwrap();
assert_eq!(e.id, WikiId::EntityId(Qid(42)));
}
#[test]
fn universe() {
let j: serde_json::Value = serde_json::from_str(include_str!("../items/Q1.json")).unwrap();
Entity::from_json(j).unwrap();
}
#[test]
fn word() {
let j: serde_json::Value = serde_json::from_str(include_str!("../items/Q31928.json")).unwrap();
Entity::from_json(j).unwrap();
}
#[test]
fn mount_everest() {
let j: serde_json::Value = serde_json::from_str(include_str!("../items/Q513.json")).unwrap();
Entity::from_json(j).unwrap();
}
#[test]
fn portugal() {
let j: serde_json::Value = serde_json::from_str(include_str!("../items/Q45.json")).unwrap();
Entity::from_json(j).unwrap();
}