Skip to content

Commit

Permalink
add test to check all footprint are in src/footprinter.ts (#178)
Browse files Browse the repository at this point in the history
* add test to check all footprint are in src/footprinter.ts

* ci: add bun test workflow
  • Loading branch information
kom-senapati authored Feb 10, 2025
1 parent 2cc3c27 commit 588ca4b
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/bun-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Created using @tscircuit/plop (npm install -g @tscircuit/plop)
name: Bun Test

on:
pull_request:
push:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Install dependencies
run: bun install

- name: Run tests
run: bun test
26 changes: 26 additions & 0 deletions tests/footprint-completeness.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { describe, expect, it } from "bun:test"
import { getFootprintNames } from "../src/footprinter"
import fs from "fs"
import path from "path"

describe("footprint completeness", () => {
it("should expose all footprint functions from src/fn/", () => {
const fnDir = path.join(process.cwd(), "src", "fn")
const footprintFiles = fs
.readdirSync(fnDir)
.filter((file) => file.endsWith(".ts") && file !== "index.ts")
.map((file) => path.basename(file, ".ts"))

const exposedFootprints = getFootprintNames()

for (const file of footprintFiles) {
expect(exposedFootprints.includes(file)).toBe(true)
}

for (const footprint of exposedFootprints) {
expect(footprintFiles.includes(footprint)).toBe(true)
}

expect(footprintFiles.length).toBe(exposedFootprints.length)
})
})

0 comments on commit 588ca4b

Please sign in to comment.