@@ -9,6 +9,7 @@ const addHooks = require('./test-common');
9
9
const verifySetup = require ( '../lib/setup' ) ;
10
10
const { action : startAction } = require ( '../lib/commands/start' ) ;
11
11
const { action : prAction } = require ( '../lib/commands/pr' ) ;
12
+ const { writeFileSync, mkdirSync } = require ( 'fs' ) ;
12
13
13
14
function extractURL ( logs ) {
14
15
return URL . parse ( logs . match ( / ^ O p e n i n g ( h t t p s : \S + ) / m) [ 1 ] , true ) ;
@@ -64,21 +65,34 @@ describe('pr', () => {
64
65
} ) ;
65
66
66
67
it ( 'respects the contents of a PULL_REQUEST_TEMPLATE' , async ( ) => {
68
+ writeFileSync ( 'PULL_REQUEST_TEMPLATE.md' , 'Important stuff' ) ;
67
69
const url = await setupForPR ( t , [ 'feat: use a PR template' ] ) ;
68
70
assert . include (
69
71
'contents of a PULL_REQUEST_TEMPLATE.md file' ,
70
- "Please ensure you adequately describe both the problem you're solving for" ,
72
+ 'Important stuff' ,
73
+ url . query . body
74
+ ) ;
75
+ } ) ;
76
+
77
+ it ( 'respects the contents of a .github/pull_request_template' , async ( ) => {
78
+ mkdirSync ( '.github' ) ;
79
+ writeFileSync ( '.github/pull_request_template.md' , 'Other stuff' ) ;
80
+ const url = await setupForPR ( t , [ 'feat: use a PR template' ] ) ;
81
+ assert . include (
82
+ 'contents of a pull_request_template.md file' ,
83
+ 'Other stuff' ,
71
84
url . query . body
72
85
) ;
73
86
} ) ;
74
87
75
88
it ( 'optionally ignores PULL_REQUEST_TEMPLATE' , async ( ) => {
89
+ writeFileSync ( 'PULL_REQUEST_TEMPLATE.md' , 'Important stuff' ) ;
76
90
const url = await setupForPR ( t , [ 'feat: use a PR template' ] , {
77
91
ignorePrTemplate : true ,
78
92
} ) ;
79
93
assert . notInclude (
80
94
'contents of the PULL REQUEST TEMPLATE are not present' ,
81
- "Please ensure you adequately describe both the problem you're solving for" ,
95
+ 'Important stuff' ,
82
96
url . query . body
83
97
) ;
84
98
} ) ;
0 commit comments