Skip to content

Commit 43473ea

Browse files
committed
feat: unit test
1 parent 799bce9 commit 43473ea

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

rust/signed_doc/src/validator/rules/content_type.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,4 +216,18 @@ mod tests {
216216
let doc = Builder::new().build();
217217
assert!(matches!(json_rule.check(&doc).await, Ok(false)));
218218
}
219+
220+
#[tokio::test]
221+
async fn content_type_not_specified_rule_test() {
222+
let content_type = ContentType::Json;
223+
let rule = ContentTypeRule::NotSpecified;
224+
225+
let doc = Builder::new()
226+
.with_metadata_field(SupportedField::ContentType(content_type))
227+
.build();
228+
assert!(!rule.check(&doc).await.unwrap());
229+
230+
let doc = Builder::new().build();
231+
assert!(rule.check(&doc).await.unwrap());
232+
}
219233
}

0 commit comments

Comments
 (0)