request the review classifier when a pr is opened or reopened
This commit is contained in:
parent
668bd5d46c
commit
b1a00a3222
1 changed files with 110 additions and 38 deletions
|
|
@ -435,6 +435,29 @@ mod tests {
|
|||
assert!(evaluate(&f, "pull_request_sync", &pull("assigned", "PR")).is_empty());
|
||||
}
|
||||
|
||||
/// The built-in classifier flow requests on a push, an open and a reopen,
|
||||
/// and on no other action of a `pull_request` event.
|
||||
#[test]
|
||||
fn the_classifier_flow_requests_on_open_reopen_and_push_only() {
|
||||
let f = swarm_wire::notify_flows::builtins()
|
||||
.into_iter()
|
||||
.find(|f| f.id == "head-classifier")
|
||||
.expect("the built-in");
|
||||
assert_eq!(f.validate(), Ok(()));
|
||||
let pull = |action: &str| {
|
||||
let mut fields = event(action, &[], &[], &[]);
|
||||
fields.insert("kind", text("PR"));
|
||||
fields
|
||||
};
|
||||
let got = |event_type: &str, action: &str| requests(&f, event_type, &pull(action)).len();
|
||||
assert_eq!(got("pull_request", "opened"), 1);
|
||||
assert_eq!(got("pull_request", "reopened"), 1);
|
||||
assert_eq!(got("pull_request_sync", "synchronized"), 1);
|
||||
assert_eq!(got("pull_request", "closed"), 0);
|
||||
assert_eq!(got("pull_request", "edited"), 0);
|
||||
assert_eq!(got("pull_request_assign", "opened"), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_placeholder_expands_to_its_field_and_an_unknown_one_is_an_error() {
|
||||
let fields = event("assigned", &["a", "b"], &[], &[]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue