@@ -42,6 +42,7 @@ class TestCIHelper extends CIHelper {
42
42
public ghGlue : GitHubGlue ; // not readonly reference
43
43
public addPRCommentCalls : string [ ] [ ] ; // reference mock.calls
44
44
public updatePRCalls : string [ ] [ ] ; // reference mock.calls
45
+ public addPRLabelsCalls : any [ ] [ ] ; // reference mock.calls
45
46
46
47
public constructor ( workDir ?: string , debug = false , gggDir = "." ) {
47
48
super ( workDir , debug , gggDir ) ;
@@ -61,6 +62,12 @@ class TestCIHelper extends CIHelper {
61
62
this . ghGlue . updatePR = updatePR ;
62
63
this . updatePRCalls = updatePR . mock . calls ;
63
64
65
+ const addPRLabels = jest . fn ( async ( _ : string , labels : string [ ] ) :
66
+ // eslint-disable-next-line @typescript-eslint/require-await
67
+ Promise < string [ ] > => labels ) ;
68
+ this . ghGlue . addPRLabels = addPRLabels ;
69
+ this . addPRLabelsCalls = addPRLabels . mock . calls ;
70
+
64
71
// need keys to authenticate
65
72
// this.ghGlue.ensureAuthenticated = async (): Promise<void> => {};
66
73
}
@@ -887,6 +894,7 @@ test("handle push/comment too many commits fails", async () => {
887
894
888
895
expect ( ci . addPRCommentCalls [ 0 ] [ 1 ] ) . toMatch ( / W e l c o m e / ) ;
889
896
expect ( ci . addPRCommentCalls [ 1 ] [ 1 ] ) . toMatch ( failMsg ) ;
897
+ expect ( ci . addPRLabelsCalls [ 0 ] [ 1 ] ) . toEqual ( [ "new user" ] ) ;
890
898
} ) ;
891
899
892
900
test ( "handle push/comment merge commits fails" , async ( ) => {
@@ -990,6 +998,7 @@ test("handle push/comment merge commits fails", async () => {
990
998
991
999
expect ( ci . addPRCommentCalls [ 0 ] [ 1 ] ) . toMatch ( / W e l c o m e / ) ;
992
1000
expect ( ci . addPRCommentCalls [ 1 ] [ 1 ] ) . toMatch ( commits [ 0 ] . commit ) ;
1001
+ expect ( ci . addPRLabelsCalls [ 0 ] [ 1 ] ) . toEqual ( [ "new user" ] ) ;
993
1002
ci . addPRCommentCalls . length = 0 ;
994
1003
995
1004
// Test Multiple merges
0 commit comments