Commit 12c78a7b authored by Jerome Wu's avatar Jerome Wu

Add tests for mpeg1, mpeg2 and flac, increase timeout

parent d30ad812
module.exports = {
TIMEOUT: 120000,
TIMEOUT: 300000,
};
const fs = require('fs');
const path = require('path');
const { TIMEOUT } = require('./config');
const { runFFmpeg } = require('./utils');
const IN_FILE_NAME = 'audio-1s.wav';
const OUT_FILE_NAME = 'audio.flac';
const FILE_SIZE = 31871;
let wavData = null;
beforeAll(() => {
wavData = Uint8Array.from(fs.readFileSync(path.join(__dirname, 'data', IN_FILE_NAME)));
});
test('convert wav to flac', async () => {
const args = ['-i', IN_FILE_NAME, OUT_FILE_NAME];
const { fileSize } = await runFFmpeg(IN_FILE_NAME, wavData, args, OUT_FILE_NAME);
expect(fileSize).toBe(FILE_SIZE);
}, TIMEOUT);
const fs = require('fs');
const path = require('path');
const { TIMEOUT } = require('./config');
const { runFFmpeg } = require('./utils');
const IN_FILE_NAME = 'video-1s.avi';
const OUT_FILE_NAME = 'video.mpeg';
const FILE_SIZE = 53248;
let aviData = null;
beforeAll(() => {
aviData = Uint8Array.from(fs.readFileSync(path.join(__dirname, 'data', IN_FILE_NAME)));
});
test('transcode avi to mpeg1', async () => {
const args = ['-i', IN_FILE_NAME, '-c:v', 'mpeg1video', OUT_FILE_NAME];
const { fileSize } = await runFFmpeg(IN_FILE_NAME, aviData, args, OUT_FILE_NAME);
expect(fileSize).toBe(FILE_SIZE);
}, TIMEOUT);
const fs = require('fs');
const path = require('path');
const { TIMEOUT } = require('./config');
const { runFFmpeg } = require('./utils');
const IN_FILE_NAME = 'video-1s.avi';
const OUT_FILE_NAME = 'video.mpg';
const FILE_SIZE = 49152;
let aviData = null;
beforeAll(() => {
aviData = Uint8Array.from(fs.readFileSync(path.join(__dirname, 'data', IN_FILE_NAME)));
});
test('transcode avi to mpeg1', async () => {
const args = ['-i', IN_FILE_NAME, '-c:v', 'mpeg2video', OUT_FILE_NAME];
const { fileSize } = await runFFmpeg(IN_FILE_NAME, aviData, args, OUT_FILE_NAME);
expect(fileSize).toBe(FILE_SIZE);
}, TIMEOUT);
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