rushabhcodes/usb-c-e-paper-display

USB-C powered RP2354B controller board with protected power regulation, EPD display interface and charge-pump rails, crystal timing, user/boot switches, status LEDs, and SWD test points.

Version
1.4.1
License
unset
Stars
0

Use with the tscircuit CLI

tsci is the tscircuit CLI. Install it with npm install -g tscircuit.

tsci clone rushabhcodes/usb-c-e-paper-display  # download the package files into ./usb-c-e-paper-display
tsci add rushabhcodes/usb-c-e-paper-display    # add it to your project as @tsci/rushabhcodes.usb-c-e-paper-display

In a cloned or new (tsci init) project: tsci dev starts a local preview, tsci build outputs Circuit JSON, and tsci push publishes to tscircuit.com.

tests/supplier-stock.test.mjs

import {test,expect} from 'bun:test'
import {parseJlcStock} from '../product/supplier-stock'
const transport=rows=>`<script>self.__next_f.push(${JSON.stringify([1,rows.map((r,i)=>`${i}:${JSON.stringify(r)}\n`).join('')])})</script>`
test('uses the exact supplier SKU, never stock from a recommendation',()=>{
 const html=transport([{componentCode:'C111',overseasStockCount:9999},{componentCode:'C2040',overseasStockCount:17,initialPrice:1.08}])
 expect(parseJlcStock(html,'C2040')).toEqual({stock:17,price:1.08})
})
test('retains a confirmed zero quantity',()=>{
 expect(parseJlcStock(transport([{componentCode:'C2040',overseasStockCount:0}]),'C2040')).toEqual({stock:0,price:null})
})
test('does not invent availability for missing or malformed supplier data',()=>{
 expect(parseJlcStock('<html>Unavailable</html>','C2040')).toBeUndefined()
 expect(parseJlcStock(transport([{componentCode:'C2040',overseasStockCount:null}]),'C2040')).toBeUndefined()
})