Skip to content

Commit a19e9a6

Browse files
committed
test(): test no mutation
1 parent fba1306 commit a19e9a6

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

test/intersect.spec.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ describe('path-intersection', function() {
2424
it('parsePathCurve', function() {
2525

2626
// when
27-
var parsed1 = parsePathCurve(p1);
28-
var parsed2 = parsePathCurve(p2);
27+
const parsed1 = parsePathCurve(p1);
28+
const parsed2 = parsePathCurve(p2);
2929

3030
// then
3131
expect(parsed1).to.deep.eq([['M', 0, 0], ['C', 0, 0, 100, 100, 100, 100]])
@@ -34,6 +34,22 @@ describe('path-intersection', function() {
3434
expect(parsed2).to.deep.eq([['M', 0, 100], ['C', 0, 100, 100, 0, 100, 0]])
3535
expect(parsed2.parsed).to.eq(true)
3636

37+
expect(intersect(parsed1, parsed2)).to.deep.eq([
38+
{
39+
x: 50,
40+
y: 50,
41+
segment1: 1,
42+
segment2: 1,
43+
t1: 0.5,
44+
t2: 0.5,
45+
bez1: [0, 0, 0, 0, 100, 100, 100, 100],
46+
bez2: [0, 100, 0, 100, 100, 0, 100, 0]
47+
}
48+
])
49+
50+
expect(parsed1, 'intersect should not mutate paths').to.deep.eq([['M', 0, 0], ['C', 0, 0, 100, 100, 100, 100]])
51+
expect(parsed2, 'intersect should not mutate paths').to.deep.eq([['M', 0, 100], ['C', 0, 100, 100, 0, 100, 0]])
52+
3753
});
3854

3955

0 commit comments

Comments
 (0)