@@ -592,7 +592,7 @@ func TestHandleEvent(t *testing.T) {
592592 {
593593 event : "pull_request" ,
594594 payloads : []string {"create_pr_non_owner" },
595- name : "Add a label when the author cannot merge" ,
595+ name : "Remove a label when the author cannot merge" ,
596596 config : LabelerConfigV1 {
597597 Version : 1 ,
598598 Labels : []LabelMatcher {
@@ -605,6 +605,56 @@ func TestHandleEvent(t *testing.T) {
605605 initialLabels : []string {"Test" },
606606 expectedLabels : []string {},
607607 },
608+ {
609+ event : "pull_request" ,
610+ payloads : []string {"create_pr_non_owner" },
611+ name : "Add a label when the author cannot merge" ,
612+ config : LabelerConfigV1 {
613+ Version : 1 ,
614+ Labels : []LabelMatcher {
615+ {
616+ Label : "Test" ,
617+ AuthorCanMerge : "False" ,
618+ },
619+ },
620+ },
621+ initialLabels : []string {},
622+ expectedLabels : []string {"Test" },
623+ },
624+ {
625+ event : "pull_request" ,
626+ payloads : []string {"create_pr" },
627+ name : "Remove label when the author can merge" ,
628+ config : LabelerConfigV1 {
629+ Version : 1 ,
630+ Labels : []LabelMatcher {
631+ {
632+ Label : "Test" ,
633+ AuthorCanMerge : "False" ,
634+ },
635+ },
636+ },
637+ initialLabels : []string {"Test" },
638+ expectedLabels : []string {},
639+ },
640+ {
641+ event : "pull_request" ,
642+ payloads : []string {"create_pr" },
643+ name : "Negate when the author can merge" ,
644+ config : LabelerConfigV1 {
645+ Version : 1 ,
646+ Labels : []LabelMatcher {
647+ {
648+ Label : "Test" ,
649+ Draft : "False" , // payload is not a draft
650+ AuthorCanMerge : "True" , // payload author is the owner
651+ Negate : true , // both matchers are true, result should be false
652+ },
653+ },
654+ },
655+ initialLabels : []string {"Test" },
656+ expectedLabels : []string {},
657+ },
608658
609659 // Issues
610660
0 commit comments