Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Node 20 #5

Merged
merged 2 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
})
})
Loading