1
1
import { describe , it , jest } from '@jest/globals' ;
2
+ import path from 'node:path' ;
3
+ import os from 'node:os' ;
4
+ import { concat } from '../src/ffmpeg-concat.js' ;
2
5
3
- // const isMac = os.platform() === 'darwin';
4
- // const getFile = (file: string) => path.join(process.cwd(), file);
5
- // const output = isMac ? 'example_mac.mp4' : 'example_linux.mp4';
6
+ const isMac = os . platform ( ) === 'darwin' ;
7
+ const getFile = ( file : string ) => path . join ( process . cwd ( ) , file ) ;
8
+ const output = isMac ? 'example_mac.mp4' : 'example_linux.mp4' ;
6
9
7
10
describe ( 'concat function' , ( ) => {
8
11
it (
9
12
'should concatenate videos successfully' ,
10
- ( ) => {
13
+ async ( ) => {
11
14
const mockEnsureDirSync = jest . fn ( ) ;
12
15
// const mockInitFrames = jest.fn(() => Promise.resolve({ frames: [], scenes: [], theme: {} }));
13
16
// const mockRenderFrames = jest.fn(() => Promise.resolve('framePattern'));
@@ -31,11 +34,11 @@ describe('concat function', () => {
31
34
// transcodeVideo: mockTranscodeVideo,
32
35
// }));
33
36
34
- // await concat({
35
- // videos: [getFile('media/0.mp4'), getFile('media/0a.mp4'), getFile('media/1.mp4'), getFile('media/2.mp4')],
36
- // output: path.join('media', output),
37
- // transition: { name: 'directionalwipe', duration: 500, params: {} },
38
- // });
37
+ await concat ( {
38
+ videos : [ getFile ( 'media/0.mp4' ) , getFile ( 'media/0a.mp4' ) , getFile ( 'media/1.mp4' ) , getFile ( 'media/2.mp4' ) ] ,
39
+ output : path . join ( 'media' , output ) ,
40
+ transition : { name : 'directionalwipe' , duration : 500 , params : { } } ,
41
+ } ) ;
39
42
40
43
// Perform assertions to ensure mock functions were called as expected
41
44
// expect(mockInitFrames).toHaveBeenCalled();
0 commit comments