Skip to content

Commit

Permalink
Fleet UI: Add support for .rpm packages
Browse files Browse the repository at this point in the history
  • Loading branch information
RachelElysia committed Sep 30, 2024
1 parent 705cdd0 commit d7df400
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
1 change: 1 addition & 0 deletions changes/20537-rpm-fe
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Add support for .rpm files in add/edit software
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ const PackageForm = ({
canEdit={isEditingSoftware}
graphicName={"file-pkg"}
accept={ACCEPTED_EXTENSIONS}
message=".pkg, .msi, .exe, .deb or .rpm"
message=".pkg, .msi, .exe, .deb, or .rpm"
onFileUpload={onFileSelect}
buttonMessage="Choose file"
buttonType="link"
Expand Down
23 changes: 15 additions & 8 deletions frontend/utilities/file/fileUtils.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@ import { getPlatformDisplayName } from "./fileUtils";

describe("fileUtils", () => {
describe("getPlatformDisplayName", () => {
it("should return the correct platform display name depending on the file extension", () => {
const file = new File([""], "test.pkg");
expect(getPlatformDisplayName(file)).toEqual("macOS");
const testCases = [
{ extension: "pkg", platform: "macOS" },
{ extension: "json", platform: "macOS" },
{ extension: "mobileconfig", platform: "macOS" },
{ extension: "exe", platform: "Windows" },
{ extension: "msi", platform: "Windows" },
{ extension: "xml", platform: "Windows" },
{ extension: "deb", platform: "Linux" },
{ extension: "rpm", platform: "Linux" },
];

const file2 = new File([""], "test.exe");
expect(getPlatformDisplayName(file2)).toEqual("Windows");

const file3 = new File([""], "test.deb");
expect(getPlatformDisplayName(file3)).toEqual("linux");
testCases.forEach(({ extension, platform }) => {
it(`should return ${platform} for .${extension} files`, () => {
const file = new File([""], `test.${extension}`);
expect(getPlatformDisplayName(file)).toEqual(platform);
});
});
});
});

0 comments on commit d7df400

Please sign in to comment.