@@ -46,39 +46,6 @@ test.serial('Publish a release', async t => {
46
46
const uploadUrl = `https://github.com${ uploadUri } {?name,label}` ;
47
47
48
48
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' } } )
82
49
. post ( `/repos/${ owner } /${ repo } /releases` , {
83
50
tag_name : nextRelease . gitTag ,
84
51
target_commitish : options . branch ,
@@ -109,10 +76,6 @@ test.serial('Publish a release with one asset', async t => {
109
76
const uploadUrl = `https://github.com${ uploadUri } {?name,label}` ;
110
77
111
78
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 ( { } )
116
79
. post ( `/repos/${ owner } /${ repo } /releases` , {
117
80
tag_name : nextRelease . gitTag ,
118
81
target_commitish : options . branch ,
@@ -161,10 +124,6 @@ test.serial('Publish a release with one asset and custom github url', async t =>
161
124
githubUrl : process . env . GH_URL ,
162
125
githubApiPathPrefix : process . env . GH_PREFIX ,
163
126
} )
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 ( { } )
168
127
. post ( `/repos/${ owner } /${ repo } /releases` , {
169
128
tag_name : nextRelease . gitTag ,
170
129
target_commitish : options . branch ,
@@ -202,10 +161,6 @@ test.serial('Publish a release with an array of missing assets', async t => {
202
161
const uploadUrl = `https://github.com${ uploadUri } {?name,label}` ;
203
162
204
163
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 ( { } )
209
164
. post ( `/repos/${ owner } /${ repo } /releases` , {
210
165
tag_name : nextRelease . gitTag ,
211
166
target_commitish : options . branch ,
@@ -224,21 +179,3 @@ test.serial('Publish a release with an array of missing assets', async t => {
224
179
t . deepEqual ( t . context . error . args [ 1 ] , [ 'The asset %s is not a file, and will be ignored.' , emptyDirectory ] ) ;
225
180
t . true ( github . isDone ( ) ) ;
226
181
} ) ;
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