Skip to content

🎥 Make videos programmatically with React

Create callback-fields.test.ts

Jonny Burgerbc3db1af3e1a
diff --git a/packages/media-parser/src/test/callback-fields.test.ts b/packages/media-parser/src/test/callback-fields.test.ts
new file mode 100644
index 0000000000..528be357b9
--- /dev/null
+++ b/packages/media-parser/src/test/callback-fields.test.ts
@@ -0,0 +1,23 @@
+import {exampleVideos} from '@remotion/example-videos';
+import {expect, test} from 'bun:test';
+import {parseMedia} from '../parse-media';
+import {nodeReader} from '../readers/from-node';
+
+test('should be able to use callback fields only', async () => {
+ let assertions = 0;
+
+ const webm = await parseMedia({
+ src: exampleVideos.transparentWebm,
+ onDurationInSeconds: (durationInSeconds) => {
+ assertions++;
+ expect(durationInSeconds).toBe(5);
+ },
+ onVideoCodec: (videoCodec) => {
+ assertions++;
+ expect(videoCodec).toBe('vp8');
+ },
+ reader: nodeReader,
+ });
+ expect(assertions).toBe(2);
+ expect(webm).toEqual({});
+});