Skip to content

🎥 Make videos programmatically with React

fix tests

Jonny Burgerc10be603cd63
diff --git a/packages/core/src/loop/index.tsx b/packages/core/src/loop/index.tsx
index 704a048581..056762a47a 100644
--- a/packages/core/src/loop/index.tsx
+++ b/packages/core/src/loop/index.tsx
@@ -25,13 +25,7 @@ export const Loop: React.FC<LoopProps> = ({
);
}
- if (!Number.isFinite(times)) {
- throw new TypeError(
- `The "time" prop of a loop must be finite, but got ${times}.`
- );
- }
-
- if (times % 1 !== 0) {
+ if (times !== Infinity && times % 1 !== 0) {
throw new TypeError(
`The "times" prop of a loop must be an integer, but got ${times}.`
);
diff --git a/packages/core/src/test/loop-validation.test.tsx b/packages/core/src/test/loop-validation.test.tsx
index e99f2c98b1..18c6c4630c 100644
--- a/packages/core/src/test/loop-validation.test.tsx
+++ b/packages/core/src/test/loop-validation.test.tsx
@@ -47,7 +47,7 @@ describe('Loop-validation render should throw with invalid props', () => {
<Loop durationInFrames={'1'}>hi</Loop>
</Wrapper>
),
- /You passed to durationInFrames an argument of type string, but it must be a number./
+ /The "durationInFrames" prop of the \<Loop \/\> component must be a number, but you passed a value of type string/
);
});
test('It should throw if Loop has non-integer durationInFrames', () => {
@@ -58,7 +58,7 @@ describe('Loop-validation render should throw with invalid props', () => {
<Loop durationInFrames={1.1}>hi</Loop>
</Wrapper>
),
- /The "durationInFrames" of a loop must be an integer, but got 1.1./
+ /The \"durationInFrames\" prop of the \<Loop \/\> component must be an integer, but got 1.1./
);
});
test('It should throw if Loop has a negative duration', () => {
@@ -69,7 +69,7 @@ describe('Loop-validation render should throw with invalid props', () => {
<Loop durationInFrames={-1}>hi</Loop>
</Wrapper>
),
- /durationInFrames must be positive, but got -1./
+ /The \"durationInFrames\" prop of the \<Loop \/> component must be positive, but got -1./
);
});
});