File tree 2 files changed +16
-4
lines changed
2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ const CI_TYPES = new Map([
86
86
[ LITE_PR_PIPELINE , {
87
87
name : 'Lite PR Pipeline' ,
88
88
jobName : 'node-test-pull-request-lite-pipeline' ,
89
- pattern : / j o b \/ n o d e - t e s t - p u l l - r e q u e s t - l i t e - p i p e l i n e \/ ( \d + ) \/ p i p e l i n e / ,
89
+ pattern : / n o d e - t e s t - p u l l - r e q u e s t - l i t e - p i p e l i n e \/ ( \d + ) \/ p i p e l i n e / ,
90
90
type : LITE_CI
91
91
} ] ,
92
92
[ LITE_COMMIT , {
@@ -120,8 +120,7 @@ function parseJobFromURL(url) {
120
120
}
121
121
122
122
for ( let [ type , info ] of CI_TYPES ) {
123
- const re = new RegExp ( `job/${ info . jobName } /(\\d+)` ) ;
124
- const match = url . match ( re ) ;
123
+ const match = url . match ( info . pattern ) ;
125
124
if ( match ) {
126
125
return {
127
126
link : url ,
Original file line number Diff line number Diff line change @@ -56,10 +56,23 @@ const expected = new Map([
56
56
jobid : 7213
57
57
} ]
58
58
] ) ;
59
-
60
59
describe ( 'JobParser' , ( ) => {
61
60
it ( 'should parse CI results' , ( ) => {
62
61
const results = new JobParser ( commentsWithCI ) . parse ( ) ;
63
62
assert . deepStrictEqual ( [ ...results . entries ( ) ] , [ ...expected . entries ( ) ] ) ;
64
63
} ) ;
64
+
65
+ it ( 'should parse pipeline links' , ( ) => {
66
+ const data = [ {
67
+ 'publishedAt' : '2017-10-29T04:16:36.458Z' ,
68
+ 'bodyText' : '@contributer build started: https://ci.nodejs.org/blue/organizations/jenkins/node-test-pull-request-lite-pipeline/detail/node-test-pull-request-lite-pipeline/3009/pipeline/'
69
+ } ] ;
70
+ const results = new JobParser ( data ) . parse ( ) ;
71
+ assert . deepStrictEqual ( [ ...results . entries ( ) ] , [
72
+ [ 'LITE_PR_PIPELINE' , {
73
+ link : 'https://ci.nodejs.org/blue/organizations/jenkins/node-test-pull-request-lite-pipeline/detail/node-test-pull-request-lite-pipeline/3009/pipeline/' ,
74
+ date : '2017-10-29T04:16:36.458Z' ,
75
+ jobid : 3009
76
+ } ] ] ) ;
77
+ } ) ;
65
78
} ) ;
You can’t perform that action at this time.
0 commit comments