Skip to content

Commit 8146737

Browse files
EngenMeteague stockwell
andauthored
fix: correct JSON structure handling in get_slug_hex.ts (#17)
* fix: correct JSON structure handling in get_slug_hex.ts * Fix JSON structure handling in get_slug_hex.ts * Revert "Fix JSON structure handling in get_slug_hex.ts" This reverts commit 996e9ad. --------- Co-authored-by: EngenMe <mohamdfarouk727@gmail.com> Co-authored-by: teague stockwell <tstockwell@microsoft.com>
1 parent a24fbc4 commit 8146737

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/utils/fetch_simple_icons.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ describe('fetchIcons', () => {
5858
expect(icon.hex).toBeTruthy()
5959
expect(typeof icon.hex).toBe('string')
6060
expect(icon.hex).not.toBe('')
61+
62+
const hexValues = Object.values(icons.simpleIcons).map(icon => icon.hex)
63+
const allBlackHex = hexValues.every(hex => hex === '#000' || hex === '#000000')
64+
expect(allBlackHex).toBe(false)
6165
}
6266
})
6367
})

src/utils/get_slug_hexs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const primeCache = async () => {
2020
const res = await fetch(url, {cache: 'force-cache'})
2121
const json = await res.json()
2222
cache = {}
23-
json.icons.forEach((icon: Icon) => {
23+
json.forEach((icon: Icon) => {
2424
const iconSlug = getSlug({title: icon.title})
2525
cache![iconSlug] = {
2626
hex: addHash(icon.hex ?? fallback),

0 commit comments

Comments
 (0)