Skip to content

Commit

Permalink
Merge pull request #28 from tscircuit/snapshots
Browse files Browse the repository at this point in the history
update circuit-to-svg to fix snapshots
  • Loading branch information
seveibar authored Aug 31, 2024
2 parents 07f5283 + 894b224 commit cd2abbc
Show file tree
Hide file tree
Showing 35 changed files with 359 additions and 895 deletions.
131 changes: 121 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@tscircuit/soup-util": "^0.0.11",
"@types/node": "^20.12.13",
"ava": "^6.1.3",
"circuit-to-svg": "^0.0.3",
"circuit-to-svg": "^0.0.13",
"esbuild": "^0.21.4",
"esbuild-register": "^3.5.0",
"tsup": "^8.0.2",
Expand Down
26 changes: 13 additions & 13 deletions tests/fixtures/get-test-fixture.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { logSoup } from "@tscircuit/log-soup";
import type { AnySoupElement } from "@tscircuit/soup";
import type { ExecutionContext } from "ava";
import { pcbSoupToSvg, soupToSvg } from "circuit-to-svg";
import fs from "fs";
import path from "path";
import { fp } from "../../src";
import { logSoup } from "@tscircuit/log-soup"
import type { AnySoupElement } from "@tscircuit/soup"
import type { ExecutionContext } from "ava"
import { circuitJsonToPcbSvg, circuitJsonToSchematicSvg } from "circuit-to-svg"
import fs from "node:fs"
import path from "node:path"
import { fp } from "../../src"

export const getTestFixture = async (t: ExecutionContext) => {
const outputDir = path.join(__dirname, "../output");
const outputDir = path.join(__dirname, "../output")
if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir, { recursive: true });
fs.mkdirSync(outputDir, { recursive: true })
}

const snapshotSoup = (soup: AnySoupElement[]) => {
const outputPath = path.join(outputDir, `${t.title}.svg`);
const svg = pcbSoupToSvg(soup);
fs.writeFileSync(outputPath, svg);
};
const outputPath = path.join(outputDir, `${t.title}.svg`)
const svg = circuitJsonToPcbSvg(soup)
fs.writeFileSync(outputPath, svg)
}

return {
fp,
Expand Down
28 changes: 7 additions & 21 deletions tests/output/bga footprint.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit cd2abbc

Please sign in to comment.