@@ -46,39 +46,6 @@ test.serial('Publish a release', async t => {
4646 const uploadUrl = `https://github.com${ uploadUri } {?name,label}` ;
4747
4848 const github = authenticate ( )
49- . get ( `/repos/${ owner } /${ repo } /git/refs/tags/${ nextRelease . gitTag } ` )
50- . reply ( 404 )
51- . post ( `/repos/${ owner } /${ repo } /git/refs` , { ref : `refs/tags/${ nextRelease . gitTag } ` , sha : nextRelease . gitHead } )
52- . reply ( { } )
53- . post ( `/repos/${ owner } /${ repo } /releases` , {
54- tag_name : nextRelease . gitTag ,
55- target_commitish : options . branch ,
56- name : nextRelease . gitTag ,
57- body : nextRelease . notes ,
58- } )
59- . reply ( 200 , { upload_url : uploadUrl , html_url : releaseUrl } ) ;
60-
61- await publish ( pluginConfig , options , nextRelease , t . context . logger ) ;
62-
63- t . deepEqual ( t . context . log . args [ 0 ] , [ 'Published GitHub release: %s' , releaseUrl ] ) ;
64- t . true ( github . isDone ( ) ) ;
65- } ) ;
66-
67- test . serial ( 'Publish a release with an existing tag' , async t => {
68- const owner = 'test_user' ;
69- const repo = 'test_repo' ;
70- process . env . GITHUB_TOKEN = 'github_token' ;
71- const pluginConfig = { } ;
72- const nextRelease = { version : '1.0.0' , gitHead : '123' , gitTag : 'v1.0.0' , notes : 'Test release note body' } ;
73- const options = { branch : 'master' , repositoryUrl : `https://github.com/${ owner } /${ repo } .git` } ;
74- const releaseUrl = `https://github.com/${ owner } /${ repo } /releases/${ nextRelease . version } ` ;
75- const releaseId = 1 ;
76- const uploadUri = `/api/uploads/repos/${ owner } /${ repo } /releases/${ releaseId } /assets` ;
77- const uploadUrl = `https://github.com${ uploadUri } {?name,label}` ;
78-
79- const github = authenticate ( { } )
80- . get ( `/repos/${ owner } /${ repo } /git/refs/tags/${ nextRelease . gitTag } ` )
81- . reply ( { ref : `refs/tags/${ nextRelease . gitTag } ` , object : { sha : 'e23a1bd8d7240c1eb3287374956042ffbcadca84' } } )
8249 . post ( `/repos/${ owner } /${ repo } /releases` , {
8350 tag_name : nextRelease . gitTag ,
8451 target_commitish : options . branch ,
@@ -109,10 +76,6 @@ test.serial('Publish a release with one asset', async t => {
10976 const uploadUrl = `https://github.com${ uploadUri } {?name,label}` ;
11077
11178 const github = authenticate ( )
112- . get ( `/repos/${ owner } /${ repo } /git/refs/tags/${ nextRelease . gitTag } ` )
113- . reply ( 404 )
114- . post ( `/repos/${ owner } /${ repo } /git/refs` , { ref : `refs/tags/${ nextRelease . gitTag } ` , sha : nextRelease . gitHead } )
115- . reply ( { } )
11679 . post ( `/repos/${ owner } /${ repo } /releases` , {
11780 tag_name : nextRelease . gitTag ,
11881 target_commitish : options . branch ,
@@ -161,10 +124,6 @@ test.serial('Publish a release with one asset and custom github url', async t =>
161124 githubUrl : process . env . GH_URL ,
162125 githubApiPathPrefix : process . env . GH_PREFIX ,
163126 } )
164- . get ( `/repos/${ owner } /${ repo } /git/refs/tags/${ nextRelease . gitTag } ` )
165- . reply ( 404 )
166- . post ( `/repos/${ owner } /${ repo } /git/refs` , { ref : `refs/tags/${ nextRelease . gitTag } ` , sha : nextRelease . gitHead } )
167- . reply ( { } )
168127 . post ( `/repos/${ owner } /${ repo } /releases` , {
169128 tag_name : nextRelease . gitTag ,
170129 target_commitish : options . branch ,
@@ -202,10 +161,6 @@ test.serial('Publish a release with an array of missing assets', async t => {
202161 const uploadUrl = `https://github.com${ uploadUri } {?name,label}` ;
203162
204163 const github = authenticate ( )
205- . get ( `/repos/${ owner } /${ repo } /git/refs/tags/${ nextRelease . gitTag } ` )
206- . reply ( 404 )
207- . post ( `/repos/${ owner } /${ repo } /git/refs` , { ref : `refs/tags/${ nextRelease . gitTag } ` , sha : nextRelease . gitHead } )
208- . reply ( { } )
209164 . post ( `/repos/${ owner } /${ repo } /releases` , {
210165 tag_name : nextRelease . gitTag ,
211166 target_commitish : options . branch ,
@@ -224,21 +179,3 @@ test.serial('Publish a release with an array of missing assets', async t => {
224179 t . deepEqual ( t . context . error . args [ 1 ] , [ 'The asset %s is not a file, and will be ignored.' , emptyDirectory ] ) ;
225180 t . true ( github . isDone ( ) ) ;
226181} ) ;
227-
228- test . serial ( 'Throw Error if get tag call return an error other than 404' , async t => {
229- const owner = 'test_user' ;
230- const repo = 'test_repo' ;
231- process . env . GITHUB_TOKEN = 'github_token' ;
232- const pluginConfig = { } ;
233- const nextRelease = { version : '1.0.0' , gitHead : '123' , gitTag : 'v1.0.0' , notes : 'Test release note body' } ;
234- const options = { branch : 'master' , repositoryUrl : `https://github.com/${ owner } /${ repo } .git` } ;
235-
236- const github = authenticate ( )
237- . get ( `/repos/${ owner } /${ repo } /git/refs/tags/${ nextRelease . gitTag } ` )
238- . reply ( 500 ) ;
239-
240- const error = await t . throws ( publish ( pluginConfig , options , nextRelease , t . context . logger ) , Error ) ;
241-
242- t . is ( error . code , 500 ) ;
243- t . true ( github . isDone ( ) ) ;
244- } ) ;
0 commit comments