Adding two tests for command parser.
* Test 1: quotes appear at start of command and has a space in * Test 2: quote appears in a command, and has a space.
This commit is contained in:
@@ -4,8 +4,10 @@ const IS_BROWSER = typeof window !== 'undefined' && typeof window.document !== '
|
||||
const OPTIONS = {
|
||||
corePath: '../node_modules/@ffmpeg/core/ffmpeg-core.js',
|
||||
...(IS_BROWSER ? { workerPath: '../dist/worker.dev.js' } : {}),
|
||||
logger: ({ message }) => console.log(message),
|
||||
};
|
||||
const FLAME_MP4_LENGTH = 100374;
|
||||
const META_FLAME_MP4_LENGTH = 100408;
|
||||
|
||||
if (typeof module !== 'undefined') {
|
||||
module.exports = {
|
||||
@@ -14,5 +16,6 @@ if (typeof module !== 'undefined') {
|
||||
IS_BROWSER,
|
||||
OPTIONS,
|
||||
FLAME_MP4_LENGTH,
|
||||
META_FLAME_MP4_LENGTH,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -18,3 +18,27 @@ describe('transcode()', () => {
|
||||
));
|
||||
});
|
||||
});
|
||||
|
||||
describe('run()', () => {
|
||||
describe('should run a command with quoted parameters at start and a space in between', () => {
|
||||
['flame.avi'].forEach((name) => (
|
||||
it(`run ${name}`, async () => {
|
||||
await worker.write(name, `${BASE_URL}/${name}`);
|
||||
await worker.run(`-y -i ${name} -metadata 'title="my title"' output.mp4`);
|
||||
const { data } = await worker.read('output.mp4');
|
||||
expect(data.length).to.be(META_FLAME_MP4_LENGTH);
|
||||
}).timeout(TIMEOUT)
|
||||
));
|
||||
});
|
||||
|
||||
describe('should run a command with name quoted parameters and a space in between', () => {
|
||||
['flame.avi'].forEach((name) => (
|
||||
it(`run ${name}`, async () => {
|
||||
await worker.write(name, `${BASE_URL}/${name}`);
|
||||
await worker.run(`-y -i ${name} -metadata title="my title" output.mp4`);
|
||||
const { data } = await worker.read('output.mp4');
|
||||
expect(data.length).to.be(META_FLAME_MP4_LENGTH);
|
||||
}).timeout(TIMEOUT)
|
||||
));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user