Skip to content

Commit

Permalink
including files update test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
qdraw committed Nov 9, 2024
1 parent 095adeb commit f41b3c3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ describe("MenuDetailView", () => {

expect(trashIncl).toBeTruthy();

expect(trashIncl?.textContent).toBe("Including: jpg, arw");
expect(trashIncl?.textContent).toBe("Including: arw, jpg");

act(() => {
component.unmount();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ describe("CommaSeperatedFileList", () => {

test("should return comma-separated last parts after dot for multiple inputs", () => {
const result = comma.CommaSpaceLastDot(["example.test", "another.example", "final.test"]);
expect(result).toBe("test, example, test");
expect(result).toBe("example, test");
});

test("should handle inputs without dots", () => {
const result = comma.CommaSpaceLastDot(["example", "another", "final"]);
expect(result).toBe("example, without extension, final");
expect(result).toBe("without extension");
});

test("should handle mixed inputs with and without dots", () => {
const result = comma.CommaSpaceLastDot(["example.test", "another", "final.test"]);
expect(result).toBe("test, without extension, test");
expect(result).toBe("test, without extension");
});

test("should handle mixed inputs with and without dots", () => {
Expand All @@ -34,6 +34,6 @@ describe("CommaSeperatedFileList", () => {
"/collection/20241106_155823_DSC00339",
"final.test"
]);
expect(result).toBe("test, without extension, test");
expect(result).toBe("test, without extension");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ export class CommaSeperatedFileList {
} else {
uniqueExtensions.add(messageNoExtensionItem ? messageNoExtensionItem : "without extension");
}
uniqueExtensions.add(fileExtension);
}
return Array.from(uniqueExtensions).sort();
}

public CommaSpaceLastDot(inputs: string[], messageNoExtensionItem?: string): string {
let output = "";
const uniqueExtensionsArray = this.GetUniqueExtensions(inputs, messageNoExtensionItem);

for (let index = 0; index < uniqueExtensionsArray.length; index++) {
output += uniqueExtensionsArray[index];
if (index !== uniqueExtensionsArray.length - 1) {
output += ", ";
}
Expand Down

0 comments on commit f41b3c3

Please sign in to comment.