Skip to content

🎥 Make videos programmatically with React

Added test for `--range` flag

Shankhadeep Deyc63eec73f500
diff --git a/tests/rendering.test.ts b/tests/rendering.test.ts
index 5d4286f425..f74a67e59b 100644
--- a/tests/rendering.test.ts
+++ b/tests/rendering.test.ts
@@ -60,6 +60,7 @@ test("Should fail to render conflicting --sequence and --codec settings", async
expect(task.exitCode).toBe(process.platform === "win32" ? 0 : 1);
expect(task.stderr).toContain("Detected both --codec");
});
+
test("Should fail to render out of range CRF", async () => {
const task = await execa(
"npx",
@@ -83,3 +84,43 @@ test("Should fail to render out of range CRF", async () => {
expect(task.exitCode).toBe(process.platform === "win32" ? 0 : 1);
expect(task.stderr).toContain("CRF must be between ");
});
+
+test("Should fail to render out of range frame when range is a number", async () => {
+ const task = await execa(
+ "npx",
+ [
+ "remotion",
+ "render",
+ "src/index.tsx",
+ "react-svg",
+ '--range=301',
+ outputPath,
+ ],
+ {
+ cwd: "packages/example",
+ reject: false,
+ }
+ );
+ expect(task.exitCode).toBe(process.platform === "win32" ? 0 : 1);
+ expect(task.stderr).toContain("is greater than actual");
+});
+
+test("Should fail to render out of range frame when range is a string", async () => {
+ const task = await execa(
+ "npx",
+ [
+ "remotion",
+ "render",
+ "src/index.tsx",
+ "react-svg",
+ '--range=45-301',
+ outputPath,
+ ],
+ {
+ cwd: "packages/example",
+ reject: false,
+ }
+ );
+ expect(task.exitCode).toBe(process.platform === "win32" ? 0 : 1);
+ expect(task.stderr).toContain("is not in between");
+});