Watch
0
0
Fork
You've already forked hyperhive
0

request the review classifier when a pr is opened or reopened

This commit is contained in:
atlas 2026-10-28 03:31:38 +01:00 • committed by mara
commit b1a00a3222

View file

@ -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"], &[], &[]);