Skip to content

Commit

Permalink
chore(cli): add test for default option with empty type (#272)
Browse files Browse the repository at this point in the history
Signed-off-by: KeisukeYamashita <19yamashita15@gmail.com>
  • Loading branch information
KeisukeYamashita authored Feb 13, 2024
1 parent ac0732e commit fe8264d
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/rule/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,29 @@ mod tests {
);
}

#[test]
fn test_no_options_with_empty_type() {
let rule = Type::default();

let message = Message {
body: None,
description: None,
footers: None,
r#type: None,
raw: "invalid(scope): broadcast $destroy event on scope destruction".to_string(),
scope: None,
subject: None,
};

let violation = rule.validate(&message);
assert!(violation.is_some());
assert_eq!(violation.clone().unwrap().level, Level::Error);
assert_eq!(
violation.unwrap().message,
"type is not allowed. Only [] are allowed".to_string()
);
}

#[test]
fn test_missing_type() {
let rule = Type::default();
Expand Down

0 comments on commit fe8264d

Please sign in to comment.