🎥 Make videos programmatically with React
duration test ts
Jonny Burgeraa77b84d5e0e
diff --git a/packages/video-parser/src/test/duration.test.ts b/packages/video-parser/src/test/duration.test.tsnew file mode 100644index 0000000000..2b3e3d2646--- /dev/null+++ b/packages/video-parser/src/test/duration.test.ts@@ -0,0 +1,26 @@+import {RenderInternals} from '@remotion/renderer';+import {expect, test} from 'bun:test';+import {getDuration} from '../get-duration';+import {parseVideo} from '../parse-video';++const {exampleVideos} = RenderInternals;++test('Should get duration of video', async () => {+ const parsed = await parseVideo(exampleVideos.framer24fps, 128 * 1024);+ if (!parsed) {+ throw new Error('No parsed data');+ }++ const duration = getDuration(parsed);+ expect(duration).toBe(4.167);+});++test('Should get duration of HEVC video', async () => {+ const parsed = await parseVideo(exampleVideos.iphonehevc, Infinity);+ if (!parsed) {+ throw new Error('No parsed data');+ }++ const duration = getDuration(parsed);+ expect(duration).toBe(3.4);+});diff --git a/packages/video-parser/src/test/parse-video.test.ts b/packages/video-parser/src/test/parse-video.test.tsindex 729f32f704..483fff8cd6 100644--- a/packages/video-parser/src/test/parse-video.test.ts+++ b/packages/video-parser/src/test/parse-video.test.ts@@ -1,6 +1,5 @@import {RenderInternals} from '@remotion/renderer';import {expect, test} from 'bun:test';-import {getDuration} from '../get-duration';import {parseVideo} from '../parse-video';const {exampleVideos} = RenderInternals;@@ -133,23 +132,3 @@ test('Parse a full video', async () => {throw new Error('No extra data');}});--test('Should get duration of video', async () => {- const parsed = await parseVideo(exampleVideos.framer24fps, 128 * 1024);- if (!parsed) {- throw new Error('No parsed data');- }-- const duration = getDuration(parsed);- expect(duration).toBe(4.167);-});--test('Should get duration of HEVC video', async () => {- const parsed = await parseVideo(exampleVideos.iphonehevc, Infinity);- if (!parsed) {- throw new Error('No parsed data');- }-- const duration = getDuration(parsed);- expect(duration).toBe(3.4);-});diff --git a/packages/video-parser/tsconfig.json b/packages/video-parser/tsconfig.jsonindex cab2e0faf8..8b74cb33e0 100644--- a/packages/video-parser/tsconfig.json+++ b/packages/video-parser/tsconfig.json@@ -1,10 +1,11 @@{- "extends": "../tsconfig.settings.json",- "compilerOptions": {- "rootDir": "src",- "outDir": "./dist",- "skipLibCheck": true- },- "references": [],- "include": ["src"]+ "extends": "../tsconfig.settings.json",+ "compilerOptions": {+ "rootDir": "src",+ "outDir": "./dist",+ "skipLibCheck": true+ },+ "references": [],+ "include": ["src"],+ "exclude": ["src/**/*.test.ts"]}