From 89edddf096c7915d6faad83011b378f582442e6b Mon Sep 17 00:00:00 2001 From: seveibar Date: Wed, 28 Aug 2024 14:43:52 -0700 Subject: [PATCH] snapshot testing --- bun.lockb | Bin 98471 -> 100986 bytes package.json | 5 ++-- tests/__snapshots__/simple1.snap.svg | 7 +++++ tests/__snapshots__/simple2.snap.svg | 7 +++++ tests/fixtures/__snapshots__/simple1.snap.svg | 1 - tests/fixtures/preload.ts | 27 ++++++++++++------ ...enerate-gerber-with-basic-elements.test.ts | 7 +++-- 7 files changed, 40 insertions(+), 14 deletions(-) create mode 100644 tests/__snapshots__/simple1.snap.svg create mode 100644 tests/__snapshots__/simple2.snap.svg delete mode 100644 tests/fixtures/__snapshots__/simple1.snap.svg diff --git a/bun.lockb b/bun.lockb index c6a8fcda288d9a51c02c51fc092bcdb38f9c0cb5..bae11137b8a25eecf3e8c81fe06937a62bfbd888 100755 GIT binary patch delta 19510 zcmeHvcT`kY*Z!O<1I!4*P^2S>2&nX`=m17h7#kWLO)LRK#n7avsFA@gR&q2qmRJ&v zC3ZB%UJ@IL8f=NiSW@1ou|$)Ym_+@aeT$I1Nq+CQ*88pX`y;b_?mo{x`;@&;xz{_K zSyO5K%L429VIf^AZ1vA|Thux>ZPMvx-hIAb(r;JF_{U8=qOWYac`0j9@U59lLmz#$ zxmiV)jZ7qsrm03_$w#s=S@jm9qn<4l+pM??O)PGq;Cy9`B6|f zG$%AOE4L&ke{>G&9Rnq@DlGkwpn_c>DdM$gjS5_cqz2UfcYzUgG%K?>C$z9cBS|>M zTx9!_(&C)V{IQycu%q$|peH}GVlt(URDqKtm5@}A9FGckT9{Xe4rw9~QSxw-(gBqh zf>Q_c3WsKvjL>KXDtuT;XwKNu;>>V&xuKCIg$2WM^Kx2%QwMs(4*x8rC1p}%Kk<+o zE-A|{&Me8%)M7MUXi6337H5{`lxXtDNgdU!^O7ql9g$OzJFHw&t?;Fg)WKaSNK$ zDxjWc`^i0}u`J3gDd`G5h0McWE?59bLzATFZJNss{{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C#=N$GDv58Ab4FJ8V6@PspK*e>|DLp;erx^qsA|obHf0L;U1C#KqfdE@O?jKSF@|v# z*yBgvR5zCn%d1-&8pdhhpEez9CQlDb{yPo1U0#jrph%~&nJ|F;GI>%LvD@mEh=rQ!S^ZxZk$ z5nsk)MR*ba0I!25$Mo0^XGLM%2gd)Hg3g?o^M<+A9Y6e1z(2>CpOwy2k4*d_41}LF zw=Ih{w%zCx6$@S;{A6Z^PPJSW(eBk8u_SXY^qQQB* zVy}U9A9_anUQIv&cW|QP^H0Z*f8rBtn>;zGoIpFNbf;zZD{`dvhzP>|N%)$d6$Cde&s zTvkXBq?60Mbu9fiMJO8%(ioRpB%g3Ju%SSJyz ltdA4Jl{wv^-?o$Jtn{BLTz1W|@`N513+G+ai^Xp){{v1_8?pcZ diff --git a/package.json b/package.json index afea9ee..c97495a 100644 --- a/package.json +++ b/package.json @@ -7,13 +7,14 @@ "@tscircuit/soup": "^0.0.58", "@types/bun": "latest", "gerber-to-svg": "^4.2.8", - "tsup": "^8.2.4" + "tsup": "^8.2.4", + "bun-match-svg": "^0.0.1", + "pcb-stackup": "^4.2.8" }, "peerDependencies": { "typescript": "^5.0.0" }, "dependencies": { - "bun-match-svg": "^0.0.1", "fast-json-stable-stringify": "^2.1.0" } } diff --git a/tests/__snapshots__/simple1.snap.svg b/tests/__snapshots__/simple1.snap.svg new file mode 100644 index 0000000..e08db3d --- /dev/null +++ b/tests/__snapshots__/simple1.snap.svg @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/tests/__snapshots__/simple2.snap.svg b/tests/__snapshots__/simple2.snap.svg new file mode 100644 index 0000000..62aa963 --- /dev/null +++ b/tests/__snapshots__/simple2.snap.svg @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/tests/fixtures/__snapshots__/simple1.snap.svg b/tests/fixtures/__snapshots__/simple1.snap.svg deleted file mode 100644 index 77bbd27..0000000 --- a/tests/fixtures/__snapshots__/simple1.snap.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/tests/fixtures/preload.ts b/tests/fixtures/preload.ts index a699a44..d3918dd 100644 --- a/tests/fixtures/preload.ts +++ b/tests/fixtures/preload.ts @@ -1,6 +1,7 @@ import "bun-match-svg" import { expect } from "bun:test" -import gerberToSvg from "gerber-to-svg" +import pcbStackup from "pcb-stackup" +import { Readable } from "stream" async function toMatchGerberSnapshot( this: any, @@ -8,14 +9,22 @@ async function toMatchGerberSnapshot( testPathOriginal: string, svgName?: string, ) { - const svg = await new Promise((resolve, reject) => { - gerberToSvg(gerberOutput.Edge_Cuts, {}, (err, svg) => { - if (err) return reject(err) - resolve(svg) - }) - }) + // Create layers array from gerberOutput + const layers = Object.entries(gerberOutput).map(([filename, content]) => ({ + filename, + gerber: Readable.from(content), + })) - return expect(svg).toMatchSvgSnapshot(import.meta.path, svgName) + try { + const stackup = await pcbStackup(layers) + + // We'll use the top layer SVG for comparison, but you could choose bottom or both + const svg = stackup.top.svg + + return expect(svg).toMatchSvgSnapshot(testPathOriginal, svgName) + } catch (error) { + throw new Error(`Failed to generate PCB stackup: ${error}`) + } } expect.extend({ @@ -26,7 +35,7 @@ expect.extend({ declare module "bun:test" { interface Matchers { toMatchGerberSnapshot( - testPath: string, + testImportMetaPath: string, svgName?: string, ): Promise } diff --git a/tests/generate-gerber-with-basic-elements.test.ts b/tests/generate-gerber-with-basic-elements.test.ts index 65ad0dd..3739a5f 100644 --- a/tests/generate-gerber-with-basic-elements.test.ts +++ b/tests/generate-gerber-with-basic-elements.test.ts @@ -1,4 +1,4 @@ -import { test } from "bun:test" +import { test, expect } from "bun:test" import { convertSoupToGerberCommands } from "src/convert-soup-to-gerber-commands" import { stringifyGerberCommandLayers, @@ -77,6 +77,9 @@ test("Generate simple gerber with basic elements", async () => { // console.log(stringifyGerberCommands(gerber_cmds.B_Mask)) // TODO parse gerber to check for correctness + const gerbers = stringifyGerberCommandLayers(gerber_cmds) - await maybeOutputGerber(stringifyGerberCommandLayers(gerber_cmds)) + await maybeOutputGerber(gerbers) + + expect(gerbers).toMatchGerberSnapshot(import.meta.path, "simple2") })