Skip to content

Commit

Permalink
formatbot: Automatically format code
Browse files Browse the repository at this point in the history
  • Loading branch information
tscircuitbot committed Oct 15, 2024
1 parent a49a098 commit be5aba7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
34 changes: 19 additions & 15 deletions lib/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { expect, test, describe } from "bun:test";
import { convertCircuitJsonToBomRows, convertBomRowsToCsv } from "./index";
import type { AnyCircuitElement, PcbComponent, SourceComponentBase } from "circuit-json";
import { expect, test, describe } from "bun:test"
import { convertCircuitJsonToBomRows, convertBomRowsToCsv } from "./index"
import type {
AnyCircuitElement,
PcbComponent,
SourceComponentBase,
} from "circuit-json"

describe("convertCircuitJsonToBomRows", () => {
test("should convert circuit JSON to BOM rows", async () => {
Expand All @@ -16,19 +20,19 @@ describe("convertCircuitJsonToBomRows", () => {
ftype: "simple_resistor",
resistance: 1000,
} as SourceComponentBase,
];
]

const bomRows = await convertCircuitJsonToBomRows({ circuitJson });
const bomRows = await convertCircuitJsonToBomRows({ circuitJson })

expect(bomRows).toHaveLength(1);
expect(bomRows).toHaveLength(1)
expect(bomRows[0]).toEqual({
designator: "R1",
comment: "1k",
value: "1k",
footprint: "",
});
});
});
})
})
})

describe("convertBomRowsToCsv", () => {
test("should convert BOM rows to CSV", () => {
Expand All @@ -42,12 +46,12 @@ describe("convertBomRowsToCsv", () => {
"JLCPCB Part#": "C17513",
},
},
];
]

const csv = convertBomRowsToCsv(bomRows);
const csv = convertBomRowsToCsv(bomRows)

expect(csv).toBe(
"Designator,Comment,Value,Footprint,JLCPCB Part#\r\nR1,1k,1k,0805,C17513"
);
});
});
"Designator,Comment,Value,Footprint,JLCPCB Part#\r\nR1,1k,1k,0805,C17513",
)
})
})
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test": "bun test"
},
"devDependencies": {
"@biomejs/biome": "^1.9.2",
"@biomejs/biome": "^1.9.3",
"@types/bun": "latest",
"@types/papaparse": "^5.3.14",
"circuit-json": "^0.0.77",
Expand Down

0 comments on commit be5aba7

Please sign in to comment.