ppkarwasz commented on code in PR #418:
URL: https://github.com/apache/logging-parent/pull/418#discussion_r2150406600


##########
.github/actions/generate-dependabot-changelog/src/maven.test.ts:
##########
@@ -0,0 +1,83 @@
+// SPDX-License-Identifier: Apache-2.0
+import { getProjectVersion } from "./maven";
+
+jest.mock("fs/promises");
+import { readFile } from "fs/promises";
+const mockReadFile = readFile as jest.MockedFunction<typeof readFile>;
+
+describe("getProjectVersion", () => {
+  beforeEach(() => {
+    jest.clearAllMocks();
+  });
+
+  it("should throw an error if pom.xml does not exist", async () => {
+    mockReadFile.mockRejectedValue(new Error("File not found"));
+
+    await expect(getProjectVersion("/mock/path")).rejects.toThrow(
+      "Error reading pom.xml: File not found",
+    );
+  });
+
+  it("should throw an error if revision property is not found in pom.xml", 
async () => {
+    [
+      "project></project>",
+      "<project><properties></properties></project>",
+      "<project><properties><revision></revision></properties></project>",
+    ].forEach((content) => {

Review Comment:
   Fixed in 
https://github.com/apache/logging-parent/pull/418/commits/a125ff476bf60e2e124dc32d85c477c143b84174



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to