Lines
100 %
Functions
Branches
//! Tests for the account pick to commodity fill rule.
use super::super::{commodity_fill, parse_form_options};
const REPLY: &str = r#"(:id 1 :value "((:id \"a-one\" :label \"One\" :commodity \"u-usd\") (:id \"a-many\" :label \"Many\"))")"#;
#[test]
fn an_account_with_one_commodity_fills_it() {
let options = parse_form_options(REPLY);
assert_eq!(commodity_fill(&options, "a-one"), Some("u-usd".to_string()));
}
fn an_account_with_several_commodities_fills_nothing() {
assert_eq!(commodity_fill(&options, "a-many"), None);
fn an_unknown_account_fills_nothing() {
assert_eq!(commodity_fill(&options, ""), None);
assert_eq!(commodity_fill(&options, "a-none"), None);