Skip to content

Commit

Permalink
Alter test data for pre-relases, add test case for empty response
Browse files Browse the repository at this point in the history
  • Loading branch information
npalm committed Dec 22, 2021
1 parent 28137fe commit 22fac85
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('Synchronize action distribution.', () => {
mockS3.getObjectTagging.mockImplementation(() => {
return {
promise() {
return Promise.resolve({ TagSet: [{ Key: 'name', Value: 'actions-runner-linux-x64-2.286.0.tar.gz' }] });
return Promise.resolve({ TagSet: [{ Key: 'name', Value: 'actions-runner-linux-x64-2.285.1.tar.gz' }] });
},
};
});
Expand Down Expand Up @@ -136,7 +136,7 @@ describe('Synchronize action distribution.', () => {
});
expect(mockS3.upload).toBeCalledTimes(1);
const s3JsonBody = mockS3.upload.mock.calls[0][0];
expect(s3JsonBody['Tagging']).toEqual('name=actions-runner-linux-x64-2.286.0.tar.gz');
expect(s3JsonBody['Tagging']).toEqual('name=actions-runner-linux-x64-2.285.1.tar.gz');
});

it('Distribution should update to release if there are no pre-releases.', async () => {
Expand Down Expand Up @@ -273,6 +273,14 @@ describe('No release assets found.', () => {

await expect(sync()).rejects.toThrow(errorMessage);
});

it('Empty asset list.', async () => {
mockOctokit.repos.listReleases.mockImplementation(() => ({
data: [],
}));

await expect(sync()).rejects.toThrow(errorMessage);
});
});

describe('Invalid config', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"target_commitish": "f1ddeb0d06bdbe3182a4f01c44ef622ec0c13437",
"name": "v2.286.0",
"draft": false,
"prerelease": false,
"prerelease": true,
"created_at": "2021-12-21T15:51:03Z",
"published_at": "2021-12-21T16:09:06Z",
"assets": [
Expand Down

0 comments on commit 22fac85

Please sign in to comment.