-
Notifications
You must be signed in to change notification settings - Fork 410
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display file name in software package card UI (#22120)
- Loading branch information
1 parent
1c1ebef
commit b53d939
Showing
3 changed files
with
91 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Fixed UI design bug where software package file name was not displayed as expected. |
80 changes: 80 additions & 0 deletions
80
frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/helpers.tests.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { ISoftwareTitleDetails } from "interfaces/software"; | ||
import { getPackageCardInfo } from "./helpers"; | ||
|
||
describe("SoftwareTitleDetailsPage helpers", () => { | ||
describe("getPackageCardInfo", () => { | ||
it("returns the correct data for a software package", () => { | ||
const softwareTitle: ISoftwareTitleDetails = { | ||
id: 1, | ||
name: "Test Software", | ||
versions: [{ id: 1, version: "1.0.0", vulnerabilities: [] }], | ||
software_package: { | ||
name: "TestPackage.pkg", | ||
version: "1.0.0", | ||
self_service: true, | ||
uploaded_at: "2021-01-01T00:00:00Z", | ||
status: { | ||
installed: 10, | ||
pending_install: 5, | ||
pending_uninstall: 3, | ||
failed_install: 2, | ||
failed_uninstall: 1, | ||
}, | ||
install_script: "echo foo", | ||
icon_url: "https://example.com/icon.png", | ||
}, | ||
app_store_app: null, | ||
source: "apps", | ||
hosts_count: 10, | ||
}; | ||
const packageCardInfo = getPackageCardInfo(softwareTitle); | ||
expect(packageCardInfo).toEqual({ | ||
softwarePackage: softwareTitle.software_package, | ||
name: "TestPackage.pkg", // packages should display the package name not the software title name | ||
version: "1.0.0", | ||
uploadedAt: "2021-01-01T00:00:00Z", | ||
status: { | ||
installed: 10, | ||
pending: 8, | ||
failed: 3, | ||
}, | ||
isSelfService: true, | ||
}); | ||
}); | ||
it("returns the correct data for an app store app", () => { | ||
const softwareTitle: ISoftwareTitleDetails = { | ||
id: 1, | ||
name: "Test Software", | ||
versions: [{ id: 1, version: "1.0.0", vulnerabilities: [] }], | ||
software_package: null, | ||
app_store_app: { | ||
app_store_id: 1, | ||
name: "Test App", | ||
latest_version: "1.0.1", | ||
self_service: false, | ||
status: { | ||
installed: 10, | ||
pending: 5, | ||
failed: 3, | ||
}, | ||
icon_url: "https://example.com/icon.png", | ||
}, | ||
source: "apps", | ||
hosts_count: 10, | ||
}; | ||
const packageCardInfo = getPackageCardInfo(softwareTitle); | ||
expect(packageCardInfo).toEqual({ | ||
softwarePackage: undefined, | ||
name: "Test Software", // apps should display the software title name (backend should ensure the app name and software title name match) | ||
version: "1.0.1", | ||
uploadedAt: "", | ||
status: { | ||
installed: 10, | ||
pending: 5, | ||
failed: 3, | ||
}, | ||
isSelfService: false, | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters