Commit 5dc21ead authored by Jerome Wu's avatar Jerome Wu

Optimize test scripts

parent 12c768d5
module.exports = {
TIMEOUT: 30000,
};
Subproject commit e5e817520bcba4b56b394989ba3d136d9f110b1c
Subproject commit 96cca2e2666bd1a82c9bc46b95e50e195f438c23
const fs = require('fs');
const path = require('path');
const { TIMEOUT } = require('./config');
const { runFFmpeg } = require('./utils');
const aviFilePath = path.join(__dirname, 'data', 'video-1s.avi');
const MP4_SIZE = 38372;
let aviData = null;
beforeAll(async () => {
aviData = Uint8Array.from(fs.readFileSync(aviFilePath));
});
test('transcode avi to x264 mp4', async () => {
const Core = await runFFmpeg('video.avi', aviData, ['-i', 'video.avi', 'video.mp4']);
const fileSize = Core.FS.readFile('video.mp4').length;
Core.FS.unlink('video.mp4');
expect(fileSize).toBe(MP4_SIZE);
}, TIMEOUT);
test('transcode avi to x264 mp4 twice', async () => {
for (let i = 0 ; i < 2; i++) {
const Core = await runFFmpeg('video.avi', aviData, ['-i', 'video.avi', 'video.mp4']);
const fileSize = Core.FS.readFile('video.mp4').length;
Core.FS.unlink('video.mp4');
expect(fileSize).toBe(MP4_SIZE);
}
}, TIMEOUT);
const fs = require('fs');
const path = require('path');
const { TIMEOUT } = require('./config');
const { runFFmpeg } = require('./utils');
const aviFilePath = path.join(__dirname, 'data', 'video-3s.avi');
const TIMEOUT = 120000;
const MP4_SIZE = 98326;
const WEBM_SIZE = 114591;
const aviFilePath = path.join(__dirname, 'data', 'video-1s.avi');
const WEBM_SIZE = 41878;
let aviData = null;
beforeAll(async () => {
aviData = Uint8Array.from(fs.readFileSync(aviFilePath));
});
test('transcode avi to x264 mp4', async () => {
const Core = await runFFmpeg('video.avi', aviData, ['-i', 'video.avi', 'video.mp4']);
const fileSize = Core.FS.readFile('video.mp4').length;
Core.FS.unlink('video.mp4');
expect(fileSize).toBe(MP4_SIZE);
}, TIMEOUT);
test('transcode avi to x264 mp4 twice', async () => {
for (let i = 0 ; i < 2; i++) {
const Core = await runFFmpeg('video.avi', aviData, ['-i', 'video.avi', 'video.mp4']);
const fileSize = Core.FS.readFile('video.mp4').length;
Core.FS.unlink('video.mp4');
expect(fileSize).toBe(MP4_SIZE);
}
}, TIMEOUT);
test('transcode avi to webm', async () => {
const Core = await runFFmpeg('video.avi', aviData, ['-i', 'video.avi', '-row-mt', '1', 'video.webm']);
const fileSize = Core.FS.readFile('video.webm').length;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment