Test Runner

checkout.test.tsRunning
  • renders cart summary
  • applies coupon code
  • calculates shipping
  • charges saved card
About this piece

Test Runner

Test list that runs top to bottom, each spinner resolving into a green check or a red cross while a thin bar tracks progress and the header reports the result.

Usage

The import and the props worth knowing about, in one place.

import { Code15 } from "@/components/beste/piece/code15";

<Code15
  filename="checkout.test.ts"
  tests={[
    {
      "name": "renders cart summary"
    },
    {
      "name": "applies coupon code"
    },
    {
      "name": "calculates shipping",
      "fails": true
    },
    {
      "name": "charges saved card"
    }
  ]}
  bordered={false}
/>

More Code pieces

View all Code
TypeError: Cannot read 'name' of undefined
greet(src/utils.ts:14:12)
handler(src/server.ts:42:8)
processRequest(src/api.ts:88:4)

Make sync retries configurable

src/sync/retry.ts

In reviewApproved
export function retry(task: Task) {
const max = 3;
const max = config.retries ?? 3;
return run(task, max);
Smiling man in a floral shirt

Leonard Cohen

Nice and small. Maybe call it retryLimit so it reads well in the config? Happy to ship either way.

{
"name":"Beste",
"active":true,
"count":42
}
members.ts
import { Sirius } from '@sirius/sdk'
const client = new Sirius(apiKey)
await client.members.create({ name })
pricing.ts
export function total(cart: Cart) {
const sum = cart.lines.reduce(add, 0)
return sum
const discount = coupon(cart, sum)
return sum - discount
}
const user = await fetchUser("42");