Skip to content

Commit e3ac45d

Browse files
committed
chore: add more test case
1 parent 6d70155 commit e3ac45d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

__test__/index.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,11 @@ test('cropByBBox should handle invalid padding values', (t) => {
686686
// Invalid values should silently use 0, not throw
687687
t.notThrows(() => resvg.cropByBBox(bbox, NaN))
688688
t.notThrows(() => resvg.cropByBBox(bbox, Infinity))
689+
t.notThrows(() => resvg.cropByBBox(bbox, null as any))
690+
t.notThrows(() => resvg.cropByBBox(bbox, undefined))
689691
t.notThrows(() => resvg.cropByBBox(bbox, -10))
692+
t.notThrows(() => resvg.cropByBBox(bbox, 0))
693+
t.notThrows(() => resvg.cropByBBox(bbox, -0))
690694

691695
// padding >= half of dimensions should produce transparent image, not panic
692696
t.notThrows(() => resvg.cropByBBox(bbox, bbox.width))

0 commit comments

Comments
 (0)