feat: core domain types and Filter predicate
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
use alpha_id::model::{Filter, Tags, Mode};
|
||||
|
||||
#[test]
|
||||
fn filter_billable_only_rejects_non_primary() {
|
||||
let tags = Tags { billable: false, valid: true, chapter: "I".into(), exotic: false };
|
||||
let f = Filter { billable_only: true, valid_only: false, chapters: None, exclude_exotic: false };
|
||||
assert!(!f.accepts(&tags));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn filter_default_accepts_everything() {
|
||||
let tags = Tags { billable: false, valid: false, chapter: "II".into(), exotic: true };
|
||||
assert!(Filter::default().accepts(&tags));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mode_parses_from_str() {
|
||||
assert_eq!("a".parse::<Mode>().unwrap(), Mode::A);
|
||||
assert_eq!("c".parse::<Mode>().unwrap(), Mode::C);
|
||||
}
|
||||
Reference in New Issue
Block a user