1
1
import globby from 'globby' ;
2
2
import fs from 'fs' ;
3
- import mime from 'mime-types' ;
4
3
import { getRepoInfo } from 'shipjs-lib' ;
5
4
import { Octokit } from '@octokit/rest' ;
6
5
import createGitHubRelease from '../createGitHubRelease' ;
@@ -9,7 +8,6 @@ jest.mock('@octokit/rest');
9
8
jest . mock ( 'globby' ) ;
10
9
jest . mock ( 'shipjs-lib' ) ;
11
10
jest . mock ( 'fs' ) ;
12
- jest . mock ( 'mime-types' ) ;
13
11
14
12
const getDefaultParams = ( {
15
13
assetsToUpload,
@@ -32,7 +30,7 @@ describe('createGitHubRelease', () => {
32
30
beforeEach ( ( ) => {
33
31
createRelease . mockImplementation ( ( ) => ( {
34
32
data : {
35
- upload_url : 'https://dummy/upload/url' , // eslint-disable-line camelcase
33
+ id : 'releaseId' ,
36
34
} ,
37
35
} ) ) ;
38
36
@@ -46,7 +44,6 @@ describe('createGitHubRelease', () => {
46
44
} ) ) ;
47
45
fs . readFileSync = jest . fn ( ) ;
48
46
fs . statSync = jest . fn ( ) . mockImplementation ( ( ) => ( { size : 1024 } ) ) ;
49
- mime . lookup . mockImplementation ( ( ) => 'application/zip' ) ;
50
47
globby . mockImplementation ( ( path ) => Promise . resolve ( [ path ] ) ) ;
51
48
} ) ;
52
49
@@ -92,24 +89,20 @@ describe('createGitHubRelease', () => {
92
89
Array [
93
90
Array [
94
91
Object {
95
- "file": undefined,
96
- "headers": Object {
97
- "content-length": 1024,
98
- "content-type": "application/zip",
99
- },
92
+ "data": undefined,
100
93
"name": "path1",
101
- "url": "https://dummy/upload/url",
94
+ "owner": "my",
95
+ "release_id": "releaseId",
96
+ "repo": "repo",
102
97
},
103
98
],
104
99
Array [
105
100
Object {
106
- "file": undefined,
107
- "headers": Object {
108
- "content-length": 1024,
109
- "content-type": "application/zip",
110
- },
101
+ "data": undefined,
111
102
"name": "path2",
112
- "url": "https://dummy/upload/url",
103
+ "owner": "my",
104
+ "release_id": "releaseId",
105
+ "repo": "repo",
113
106
},
114
107
],
115
108
]
@@ -139,24 +132,20 @@ describe('createGitHubRelease', () => {
139
132
Array [
140
133
Array [
141
134
Object {
142
- "file": undefined,
143
- "headers": Object {
144
- "content-length": 1024,
145
- "content-type": "application/zip",
146
- },
135
+ "data": undefined,
147
136
"name": "path1",
148
- "url": "https://dummy/upload/url",
137
+ "owner": "my",
138
+ "release_id": "releaseId",
139
+ "repo": "repo",
149
140
},
150
141
],
151
142
Array [
152
143
Object {
153
- "file": undefined,
154
- "headers": Object {
155
- "content-length": 1024,
156
- "content-type": "application/zip",
157
- },
144
+ "data": undefined,
158
145
"name": "path2",
159
- "url": "https://dummy/upload/url",
146
+ "owner": "my",
147
+ "release_id": "releaseId",
148
+ "repo": "repo",
160
149
},
161
150
],
162
151
]
@@ -186,13 +175,11 @@ describe('createGitHubRelease', () => {
186
175
Array [
187
176
Array [
188
177
Object {
189
- "file": undefined,
190
- "headers": Object {
191
- "content-length": 1024,
192
- "content-type": "application/zip",
193
- },
178
+ "data": undefined,
194
179
"name": "path1",
195
- "url": "https://dummy/upload/url",
180
+ "owner": "my",
181
+ "release_id": "releaseId",
182
+ "repo": "repo",
196
183
},
197
184
],
198
185
]
0 commit comments