Skip to content

Commit

Permalink
Merge pull request #5 from Polymathian/update-node-20
Browse files Browse the repository at this point in the history
Use Node 20
  • Loading branch information
Josh-Zhou authored Apr 9, 2024
2 parents 29b7fa0 + d653751 commit 0fd9f8c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ outputs:
version_number:
description: 'The incremented version number'
runs:
using: 'node12'
using: 'node20'
main: 'dist/index.js'
30 changes: 30 additions & 0 deletions index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ function mockListPackageVersionsReturn(versions, defaultDisplayVersion) {
});
}

/**
* Mock listPackageVersions failing with ResourceNotFoundException
*/
const mockListPackageVersionsError = () => {
AWS.remock("CodeArtifact", "listPackageVersions", (params, callback) => {
callback({
message: "ResourceNotFoundException",
name: "ResourceNotFoundException",
code: "ResourceNotFoundException",
time: new Date(),
});
})
}

describe("incrementVersionString", () => {
test.each([
{version: "1", increment: 1, expected: "2"},
Expand Down Expand Up @@ -92,3 +106,19 @@ describe('computeVersion prefix', () => {
await expect(res).rejects.toThrow();
});
});

describe("package not exists in CA", () => {
test("returns correct version if package not exists.", async () => {
mockListPackageVersionsError();
const res = await computeVersion(
"domain",
"package",
"repository",
"format",
"4.5",
false,
1
);
expect(res).toBe("4.5.1")
})
})

0 comments on commit 0fd9f8c

Please sign in to comment.