1
use super::*;
2

            
3
#[test]
4
1
fn account_suggestion_matches_case_insensitive() {
5
1
    let suggestion = AccountSuggestion {
6
1
        id: "123".into(),
7
1
        name: "Checking Account".into(),
8
1
        currency: Some("456".into()),
9
1
    };
10
1
    assert!(suggestion.matches("checking"));
11
1
    assert!(suggestion.matches("ACCOUNT"));
12
1
    assert!(suggestion.matches("Checking"));
13
1
    assert!(!suggestion.matches("savings"));
14
1
}
15

            
16
#[test]
17
1
fn account_suggestion_returns_correct_id() {
18
1
    let suggestion = AccountSuggestion {
19
1
        id: "acc-123".into(),
20
1
        name: "Test".into(),
21
1
        currency: Some("cur-456".into()),
22
1
    };
23
1
    assert_eq!(suggestion.get_id(), "acc-123");
24
1
}
25

            
26
#[test]
27
1
fn tag_matches_name_or_value() {
28
1
    let suggestion = TagSuggestion {
29
1
        name: "category".into(),
30
1
        value: Some("groceries".into()),
31
1
    };
32
1
    assert!(suggestion.matches("cat"));
33
1
    assert!(suggestion.matches("CATEGORY"));
34
1
    assert!(suggestion.matches("groc"));
35
1
    assert!(!suggestion.matches("transport"));
36
1
}
37

            
38
#[test]
39
1
fn tag_matches_name_only_when_no_value() {
40
1
    let suggestion = TagSuggestion {
41
1
        name: "status".into(),
42
1
        value: None,
43
1
    };
44
1
    assert!(suggestion.matches("stat"));
45
1
    assert!(!suggestion.matches("value"));
46
1
}
47

            
48
#[test]
49
1
fn tag_returns_name_as_id() {
50
1
    let suggestion = TagSuggestion {
51
1
        name: "priority".into(),
52
1
        value: Some("high".into()),
53
1
    };
54
1
    assert_eq!(suggestion.get_id(), "priority");
55
1
}