@@ -32,6 +32,15 @@ I hope it works`,
32
32
33
33
// Destructuring for easier access later
34
34
let { owner, repo, base, branch } = validRequest ;
35
+ const mockCommitList = {
36
+ commits : [ { sha : "ef105a72c03ce2743d90944c2977b1b5563b43c0" } ]
37
+ } ;
38
+ const mockSecondCommitList = {
39
+ commits : [ { sha : "45d77edc93556e3a997bf73d5ed4d9fb57068928" } ]
40
+ } ;
41
+ const mockSubmoduleCommitList = {
42
+ commits : [ { sha : "ef105a72c03ce2743d90944c2977b1b5563b43c0" } ]
43
+ } ;
35
44
36
45
for ( let req of [ "owner" , "repo" , "branch" ] ) {
37
46
const body = { ...validRequest } ;
@@ -163,7 +172,7 @@ test(`success (submodule, branch exists)`, async () => {
163
172
mockCommitSubmodule ( `sha-${ branch } ` ) ;
164
173
mockUpdateRef ( branch ) ;
165
174
166
- await expect ( run ( body ) ) . resolves . toEqual ( branch ) ;
175
+ await expect ( run ( body ) ) . resolves . toEqual ( mockSubmoduleCommitList ) ;
167
176
} ) ;
168
177
169
178
test ( `success (branch exists)` , async ( ) => {
@@ -177,7 +186,7 @@ test(`success (branch exists)`, async () => {
177
186
mockCommit ( `sha-${ branch } ` ) ;
178
187
mockUpdateRef ( branch ) ;
179
188
180
- await expect ( run ( body ) ) . resolves . toEqual ( branch ) ;
189
+ await expect ( run ( body ) ) . resolves . toEqual ( mockCommitList ) ;
181
190
} ) ;
182
191
183
192
test ( `success (committer details)` , async ( ) => {
@@ -198,7 +207,7 @@ test(`success (committer details)`, async () => {
198
207
} ) ;
199
208
mockUpdateRef ( branch ) ;
200
209
201
- await expect ( run ( body ) ) . resolves . toEqual ( branch ) ;
210
+ await expect ( run ( body ) ) . resolves . toEqual ( mockCommitList ) ;
202
211
} ) ;
203
212
204
213
test ( `success (author details)` , async ( ) => {
@@ -219,7 +228,7 @@ test(`success (author details)`, async () => {
219
228
} ) ;
220
229
mockUpdateRef ( branch ) ;
221
230
222
- await expect ( run ( body ) ) . resolves . toEqual ( branch ) ;
231
+ await expect ( run ( body ) ) . resolves . toEqual ( mockCommitList ) ;
223
232
} ) ;
224
233
225
234
test ( `success (createBranch, base provided)` , async ( ) => {
@@ -235,7 +244,7 @@ test(`success (createBranch, base provided)`, async () => {
235
244
mockCommit ( `sha-${ base } ` ) ;
236
245
mockCreateRef ( branch ) ;
237
246
238
- await expect ( run ( body ) ) . resolves . toEqual ( branch ) ;
247
+ await expect ( run ( body ) ) . resolves . toEqual ( mockCommitList ) ;
239
248
} ) ;
240
249
241
250
test ( `success (createBranch, use default base branch)` , async ( ) => {
@@ -256,7 +265,7 @@ test(`success (createBranch, use default base branch)`, async () => {
256
265
mockCommit ( `sha-${ repoDefaultBranch } ` ) ;
257
266
mockCreateRef ( branch ) ;
258
267
259
- await expect ( run ( body ) ) . resolves . toEqual ( branch ) ;
268
+ await expect ( run ( body ) ) . resolves . toEqual ( mockCommitList ) ;
260
269
} ) ;
261
270
262
271
test ( `success (createBranch, use default base branch, multiple commits)` , async ( ) => {
@@ -288,7 +297,9 @@ test(`success (createBranch, use default base branch, multiple commits)`, async
288
297
mockCommitSecond ( `ef105a72c03ce2743d90944c2977b1b5563b43c0` ) ;
289
298
mockCreateRef ( branch , `45d77edc93556e3a997bf73d5ed4d9fb57068928` ) ;
290
299
291
- await expect ( run ( body ) ) . resolves . toEqual ( branch ) ;
300
+ await expect ( run ( body ) ) . resolves . toEqual ( {
301
+ commits : [ ...mockCommitList . commits , ...mockSecondCommitList . commits ]
302
+ } ) ;
292
303
} ) ;
293
304
294
305
test ( "success (ignore missing deleted files)" , async ( ) => {
@@ -321,7 +332,7 @@ test("success (ignore missing deleted files)", async () => {
321
332
changes
322
333
} ;
323
334
324
- await expect ( run ( body ) ) . resolves . toEqual ( branch ) ;
335
+ await expect ( run ( body ) ) . resolves . toEqual ( mockSecondCommitList ) ;
325
336
} ) ;
326
337
327
338
test ( "success (fileToDelete exists)" , async ( ) => {
@@ -352,7 +363,7 @@ test("success (fileToDelete exists)", async () => {
352
363
changes
353
364
} ;
354
365
355
- await expect ( run ( body ) ) . resolves . toEqual ( branch ) ;
366
+ await expect ( run ( body ) ) . resolves . toEqual ( mockSecondCommitList ) ;
356
367
} ) ;
357
368
358
369
test ( "failure (fileToDelete is missing)" , async ( ) => {
0 commit comments