Repository: Azure/azure-rest-api-specs
File: .github/shared/test/changed-files.test.js (JavaScript)

Code before:
        total: 2,
      });
      expect(mockDiff).toHaveBeenCalledWith(["--name-status", "--no-renames", "HEAD^", "HEAD"]);
    });

    it("should accept multiple gitOptions", async () => {
      mockDiff.mockResolvedValue("A\tfile1.json");
      const result = await getChangedFilesStatuses({
        gitOptions: ["--no-renames", "--find-copies"],
      });
      expect(result).toEqual({
        additions: ["file1.json"],
        modifications: [],
        deletions: [],
        renames: [],
        total: 1,
      });
      expect(mockDiff).toHaveBeenCalledWith([
        "--name-status",
        "--no-renames",
        "--find-copies",
        "HEAD^",
        "HEAD",
      ]);
    });
    it("should log categories selectively with a logger (covers false branches of per-category logging)", async () => {
      // When only some categories are populated and a logger is provided, the per-category
      // if-blocks whose category is empty should take their false branch.
      const gitOutput = [
        "A\tspecification/service1/readme.md",
        "A\tspecification/service2/main.tsp",
      ].join("\n");

      mockDiff.mockResolvedValue(gitOutput);
      const result = await getChangedFilesStatuses({ logger: debugLogger });
      expect(result).toEqual({
        additions: ["specification/service1/readme.md", "specification/service2/main.tsp"],
        modifications: [],
        deletions: [],
        renames: [],
        total: 2,
      });

      // Also test with no additions so the additions log block's false branch is covered
      const gitOutputNoAdditions = "M\tspecification/service1/readme.md";
      mockDiff.mockResolvedValue(gitOutputNoAdditions);
      const result2 = await getChangedFilesStatuses({ logger: debugLogger });
      expect(result2).toEqual({
        additions: [],
        modifications: ["specification/service1/readme.md"],
        deletions: [],

Review comment (suggestion):
```suggestion

    it("should log categories selectively with a logger (covers false branches of per-category logging)", async () => {
```

Code after:
        total: 2,
      });
      expect(mockDiff).toHaveBeenCalledWith(["--name-status", "--no-renames", "HEAD^", "HEAD"]);
    });

    it("should accept multiple gitOptions", async () => {
      mockDiff.mockResolvedValue("A\tfile1.json");
      const result = await getChangedFilesStatuses({
        gitOptions: ["--no-renames", "--find-copies"],
      });
      expect(result).toEqual({
        additions: ["file1.json"],
        modifications: [],
        deletions: [],
        renames: [],
        total: 1,
      });
      expect(mockDiff).toHaveBeenCalledWith([
        "--name-status",
        "--no-renames",
        "--find-copies",
        "HEAD^",
        "HEAD",
      ]);
    });

    it("should log categories selectively with a logger", async () => {
      // When only some categories are populated and a logger is provided, the per-category
      // if-blocks whose category is empty should take their false branch.
      const gitOutput = [
        "A\tspecification/service1/readme.md",
        "A\tspecification/service2/main.tsp",
      ].join("\n");

      mockDiff.mockResolvedValue(gitOutput);
      const result = await getChangedFilesStatuses({ logger: debugLogger });
      expect(result).toEqual({
        additions: ["specification/service1/readme.md", "specification/service2/main.tsp"],
        modifications: [],
        deletions: [],
        renames: [],
        total: 2,
      });

      // Also test with no additions so the additions log block's false branch is covered
      const gitOutputNoAdditions = "M\tspecification/service1/readme.md";
      mockDiff.mockResolvedValue(gitOutputNoAdditions);
      const result2 = await getChangedFilesStatuses({ logger: debugLogger });
      expect(result2).toEqual({
        additions: [],
        modifications: ["specification/service1/readme.md"],