Skip to content

🎥 Make videos programmatically with React

fix tests

Jonny Burger652664c25a90
diff --git a/packages/shapes/src/test/make-polygon.test.ts b/packages/shapes/src/test/make-polygon.test.ts
index a66452efe8..e9b5aff409 100644
--- a/packages/shapes/src/test/make-polygon.test.ts
+++ b/packages/shapes/src/test/make-polygon.test.ts
@@ -8,9 +8,9 @@ test('Should be able to make a triangle path', () => {
});
expect(polygonPath).toEqual({
- path: 'M 100 0 L 186.60254037844388 150 L 13.397459621556152 150.00000000000003 L 100 0',
- width: 200,
- height: 200,
+ path: 'M 86.60254037844385 0 L 173.20508075688772 150 L 0 150.00000000000003 L 86.60254037844385 0',
+ width: 173.20508075688772,
+ height: 150.00000000000003,
transformOrigin: '100 100',
instructions: [
{type: 'M', x: 100, y: 0},
@@ -27,8 +27,8 @@ test('Should be able to make a pentagon path', () => {
radius: 100,
});
- expect(polygonPath.width).toEqual(200);
- expect(polygonPath.height).toEqual(200);
+ expect(polygonPath.width).toEqual(190.21130325903073);
+ expect(polygonPath.height).toEqual(180.90169943749476);
expect(polygonPath.transformOrigin).toEqual('100 100');
expect(polygonPath.instructions.length).toEqual(6);
expect(polygonPath.instructions[0]).toEqual({type: 'M', x: 100, y: 0});
@@ -47,8 +47,8 @@ test('Should be able to make a hexagon path', () => {
});
expect(polygonPath).toEqual({
- path: 'M 100 0 L 186.60254037844385 50 L 186.60254037844388 150 L 100 200 L 13.397459621556152 150.00000000000003 L 13.397459621556095 50.000000000000064 L 100 0',
- width: 200,
+ path: 'M 86.6025403784439 0 L 173.20508075688775 50 L 173.20508075688778 150 L 86.6025403784439 200 L 5.684341886080802e-14 150.00000000000003 L 0 50.000000000000064 L 86.6025403784439 0',
+ width: 173.20508075688778,
height: 200,
transformOrigin: '100 100',
instructions: [
diff --git a/packages/shapes/src/test/make-star.test.ts b/packages/shapes/src/test/make-star.test.ts
index c5422caf21..db13561448 100644
--- a/packages/shapes/src/test/make-star.test.ts
+++ b/packages/shapes/src/test/make-star.test.ts
@@ -8,8 +8,8 @@ test('Should be able to make a star path', () => {
outerRadius: 200,
});
- expect(starPath.width).toEqual(400);
- expect(starPath.height).toEqual(400);
+ expect(starPath.width).toEqual(380.42260651806146);
+ expect(starPath.height).toEqual(361.8033988749895);
expect(starPath.transformOrigin).toEqual('200 200');
expect(starPath.instructions.length).toEqual(12);
expect(starPath.instructions[0]).toEqual({type: 'M', x: 200, y: 0});
diff --git a/packages/shapes/src/test/polygon.test.tsx b/packages/shapes/src/test/polygon.test.tsx
index af1fd96c7a..814c971304 100644
--- a/packages/shapes/src/test/polygon.test.tsx
+++ b/packages/shapes/src/test/polygon.test.tsx
@@ -5,7 +5,7 @@ import {render} from './test-utils';
test('Should be able to make a triangle', () => {
const {container} = render(<Polygon radius={100} points={3} />);
expect(container.querySelector('path')?.getAttribute('d')).toEqual(
- 'M 100 0 L 186.60254037844388 150 L 13.397459621556152 150.00000000000003 L 100 0',
+ 'M 86.60254037844385 0 L 173.20508075688772 150 L 0 150.00000000000003 L 86.60254037844385 0',
);
});
@@ -16,7 +16,7 @@ test('Should be able to make a pentagon', () => {
.querySelector('path')
?.getAttribute('d')
?.startsWith(
- 'M 100 0 L 195.10565162951536 69.09830056250526 L 158.77852522924732',
+ 'M 95.10565162951536 0 L 190.21130325903073 69.09830056250526 L 153.8841768587627',
),
).toBeTruthy();
});
@@ -24,7 +24,7 @@ test('Should be able to make a pentagon', () => {
test('Should be able to make a hexagon', () => {
const {container} = render(<Polygon radius={100} points={6} />);
expect(container.querySelector('path')?.getAttribute('d')).toEqual(
- 'M 100 0 L 186.60254037844385 50 L 186.60254037844388 150 L 100 200 L 13.397459621556152 150.00000000000003 L 13.397459621556095 50.000000000000064 L 100 0',
+ 'M 86.6025403784439 0 L 173.20508075688775 50 L 173.20508075688778 150 L 86.6025403784439 200 L 5.684341886080802e-14 150.00000000000003 L 0 50.000000000000064 L 86.6025403784439 0',
);
});