Skip to content

🎥 Make videos programmatically with React

Create frame-bug.test.ts

Jonny Burger7c97a04d4c68
diff --git a/packages/lambda/src/test/frame-bug.test.ts b/packages/lambda/src/test/frame-bug.test.ts
new file mode 100644
index 0000000000..611063acb4
--- /dev/null
+++ b/packages/lambda/src/test/frame-bug.test.ts
@@ -0,0 +1,53 @@
+import {optimizeProfile} from '../functions/chunk-optimization/optimize-profile';
+
+test('Should not throw ongetSimulated', () => {
+ expect(
+ optimizeProfile([
+ {
+ chunk: 0,
+ frameRange: [0, 10],
+ startDate: 1631614363572,
+ timings: [200, 215, 300, 300, 110, 200, 110, 222, 130, 500, 111],
+ },
+ ])
+ ).toEqual([
+ {
+ chunk: 0,
+ frameRange: [0, 10],
+ startDate: 1631614363572,
+ timings: [200, 215, 300, 300, 110, 200, 110, 222, 130, 500, 111],
+ },
+ ]);
+});
+
+test('Should not throw ongetSimulated 2', () => {
+ expect(
+ optimizeProfile([
+ {
+ chunk: 0,
+ frameRange: [0, 5],
+ startDate: 1631614363572,
+ timings: [200, 415, 700, 1000, 1110, 1140],
+ },
+ {
+ chunk: 1,
+ frameRange: [6, 10],
+ startDate: 1631614363572,
+ timings: [200, 415, 779, 1000, 1120],
+ },
+ ])
+ ).toEqual([
+ {
+ chunk: 0,
+ frameRange: [0, 3],
+ startDate: 1631614363572,
+ timings: [200, 415, 700, 1000],
+ },
+ {
+ chunk: 1,
+ frameRange: [4, 10],
+ startDate: 1631614363572,
+ timings: [110, 140, 340, 555, 919, 1140, 1260],
+ },
+ ]);
+});