Fix conflicts

This commit is contained in:
Jerome Wu
2020-05-05 18:16:52 +08:00
5 changed files with 95 additions and 1 deletions

View File

@@ -4,6 +4,9 @@ const IS_BROWSER = typeof window !== 'undefined' && typeof window.document !== '
const OPTIONS = {
corePath: 'http://localhost:3000/node_modules/@ffmpeg/core/ffmpeg-core.js',
};
const FLAME_MP4_LENGTH = 100374;
const META_FLAME_MP4_LENGTH = 100408;
const META_FLAME_MP4_LENGTH_NO_SPACE = 100404;
if (typeof module !== 'undefined') {
module.exports = {
@@ -11,5 +14,8 @@ if (typeof module !== 'undefined') {
BASE_URL,
IS_BROWSER,
OPTIONS,
FLAME_MP4_LENGTH,
META_FLAME_MP4_LENGTH,
META_FLAME_MP4_LENGTH_NO_SPACE,
};
}

View File

@@ -25,3 +25,38 @@ describe('transcode()', () => {
});
});
});
describe('run()', () => {
describe('should run a command with quoted parameters at start no spaces', () => {
['flame.avi'].forEach((name) => (
it(`run ${name}`, async () => {
await ffmpeg.write(name, `${BASE_URL}/${name}`);
await ffmpeg.run(`-y -i ${name} -metadata 'title="test"' output.mp4`);
const data = ffmpeg.read('output.mp4');
expect(data.length).to.be(META_FLAME_MP4_LENGTH_NO_SPACE);
}).timeout(TIMEOUT)
));
});
describe('should run a command with quoted parameters at start and a space in between', () => {
['flame.avi'].forEach((name) => (
it(`run ${name}`, async () => {
await ffmpeg.write(name, `${BASE_URL}/${name}`);
await ffmpeg.run(`-y -i ${name} -metadata 'title="my title"' output.mp4`);
const data = ffmpeg.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 ffmpeg.write(name, `${BASE_URL}/${name}`);
await ffmpeg.run(`-y -i ${name} -metadata title="my title" output.mp4`);
const data = ffmpeg.read('output.mp4');
expect(data.length).to.be(META_FLAME_MP4_LENGTH);
}).timeout(TIMEOUT)
));
});
});