-
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve marketplace vendors behavior (#2168)
* Improve the marketplace vendors behavior * Use approprieted function name * Push the vendor list like it comes * Replace key by identifier (more explicit) * Improve variable name to selectedVendorIdentifiers * Update src/components/VendorSelector/__tests__/VendorSelector.test.tsx Co-authored-by: George Adams <[email protected]> * Programmatically generate vendor identifiers /util/vendors.tsx view getVendorIdentifier() * Add the expected method * Add test for getVendorIdentifier() --------- Co-authored-by: George Adams <[email protected]>
- Loading branch information
1 parent
c82adf2
commit 970d170
Showing
8 changed files
with
88 additions
and
77 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
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
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
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
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
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
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,17 @@ | ||
import getVendorIdentifier from "../vendors" | ||
import vendors from '../../json/marketplace.json'; | ||
|
||
describe("vendors", () => { | ||
it("should be lowercase", () => { | ||
const adoptium = vendors.find(v => v.name === "Adoptium"); | ||
expect(getVendorIdentifier(adoptium)).toBe("adoptium"); | ||
|
||
const ibm = vendors.find(v => v.name === "IBM"); | ||
expect(getVendorIdentifier(ibm)).toBe("ibm"); | ||
}); | ||
|
||
it("should be with no space", () => { | ||
const redhat = vendors.find(v => v.name === "Red Hat"); | ||
expect(getVendorIdentifier(redhat)).toBe("redhat"); | ||
}); | ||
}); |
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,5 @@ | ||
import VendorProps from '../components/VendorSelector' | ||
|
||
export default function getVendorIdentifier (vendor: VendorProps) { | ||
return vendor.name.toLocaleLowerCase().replace(/\s+/g, ''); | ||
} |