-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test to check all footprint are in src/footprinter.ts (#178)
* add test to check all footprint are in src/footprinter.ts * ci: add bun test workflow
- Loading branch information
1 parent
2cc3c27
commit 588ca4b
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
}) | ||
}) |