Skip to content

Commit

Permalink
prop name change inside getFootprintNamesByType
Browse files Browse the repository at this point in the history
  • Loading branch information
ShiboSoftwareDev committed Jan 17, 2025
1 parent ba9fe01 commit b63dc63
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
12 changes: 6 additions & 6 deletions src/footprinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,21 +124,21 @@ export const getFootprintNames = (): string[] => {
}

export const getFootprintNamesByType = (): {
passiveFootprints: string[]
normalFootprints: string[]
passiveFootprintNames: string[]
normalFootprintNames: string[]
} => {
const allFootprints = Object.keys(FOOTPRINT_FN)

const passiveFootprints = allFootprints.filter((name) => {
const passiveFootprintNames = allFootprints.filter((name) => {
const fn = FOOTPRINT_FN[name]

return fn.toString().includes("passive(")
})

return {
passiveFootprints,
normalFootprints: allFootprints.filter(
(name) => !passiveFootprints.includes(name),
passiveFootprintNames,
normalFootprintNames: allFootprints.filter(
(name) => !passiveFootprintNames.includes(name),
),
}
}
Expand Down
25 changes: 13 additions & 12 deletions tests/get-footprint-names.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@ test("getFootprintNames returns all footprint names", () => {
})

test("getFootprintNamesByType groups footprint names by component type", () => {
const { passiveFootprints, normalFootprints } = getFootprintNamesByType()
const { passiveFootprintNames, normalFootprintNames } =
getFootprintNamesByType()

expect(passiveFootprints).toContain("res")
expect(passiveFootprints).toContain("cap")
expect(passiveFootprints).toContain("diode")
expect(passiveFootprints).toContain("led")
expect(passiveFootprintNames).toContain("res")
expect(passiveFootprintNames).toContain("cap")
expect(passiveFootprintNames).toContain("diode")
expect(passiveFootprintNames).toContain("led")

expect(normalFootprints).toContain("dip")
expect(normalFootprints).toContain("soic")
expect(normalFootprints).toContain("qfp")
expect(normalFootprints).not.toContain("res")
expect(normalFootprints).not.toContain("cap")
expect(normalFootprints).not.toContain("diode")
expect(normalFootprints).not.toContain("led")
expect(normalFootprintNames).toContain("dip")
expect(normalFootprintNames).toContain("soic")
expect(normalFootprintNames).toContain("qfp")
expect(normalFootprintNames).not.toContain("res")
expect(normalFootprintNames).not.toContain("cap")
expect(normalFootprintNames).not.toContain("diode")
expect(normalFootprintNames).not.toContain("led")
})

0 comments on commit b63dc63

Please sign in to comment.