use assert_matches::assert_matches;
use crate::{test, ObjectType, Versioned as _};
use super::{tariff_version_with_report, Report, Version};
#[test]
fn should_guess_tariff_version_v211() {
const JSON: &str = include_str!("../../test_data/v211/every_field_set/tariff.json");
test::setup();
let Report {
version,
unexpected_fields,
} = tariff_version_with_report(JSON).unwrap();
let tariff = assert_matches!(version, Version::Certain ( tariff ) => tariff );
assert_matches!(tariff.version(), crate::Version::V211);
test::assert_no_unexpected_fields(ObjectType::Tariff, &unexpected_fields);
}
#[test]
fn should_guess_tariff_version_v221() {
const JSON: &str = include_str!("../../test_data/v221/every_field_set/tariff.json");
test::setup();
let Report {
version,
unexpected_fields,
} = tariff_version_with_report(JSON).unwrap();
let tariff = assert_matches!(version, Version::Certain ( tariff ) => tariff );
assert_matches!(tariff.version(), crate::Version::V221);
test::assert_no_unexpected_fields(ObjectType::Tariff, &unexpected_fields);
}