Reorder tests to prevent OOM

This commit is contained in:
Jerome Wu 2022-08-14 23:14:12 +08:00
parent e6fe3d1aae
commit 9656f99e4a

View File

@ -1,5 +1,23 @@
const { createFFmpeg } = FFmpeg; const { createFFmpeg } = FFmpeg;
describe('FS()', () => {
const ffmpeg = createFFmpeg(OPTIONS);
before(async function cb() {
this.timeout(0);
await ffmpeg.load();
});
it('should throw error when readdir for invalid path ', () => {
expect(() => ffmpeg.FS('readdir', '/invalid')).to.throw(/readdir/);
});
it('should throw error when readFile for invalid path ', () => {
expect(() => ffmpeg.FS('readFile', '/invalid')).to.throw(/readFile/);
});
it('should throw an default error ', () => {
expect(() => ffmpeg.FS('unlink', '/invalid')).to.throw(/Oops/);
});
});
describe('load()', () => { describe('load()', () => {
it('should throw error when corePath is not a string', async () => { it('should throw error when corePath is not a string', async () => {
const ffmpeg = createFFmpeg({ ...OPTIONS, corePath: null }); const ffmpeg = createFFmpeg({ ...OPTIONS, corePath: null });
@ -49,21 +67,3 @@ describe('run()', () => {
}, 500); }, 500);
}).timeout(TIMEOUT); }).timeout(TIMEOUT);
}); });
describe('FS()', () => {
const ffmpeg = createFFmpeg(OPTIONS);
before(async function cb() {
this.timeout(0);
await ffmpeg.load();
});
it('should throw error when readdir for invalid path ', () => {
expect(() => ffmpeg.FS('readdir', '/invalid')).to.throw(/readdir/);
});
it('should throw error when readFile for invalid path ', () => {
expect(() => ffmpeg.FS('readFile', '/invalid')).to.throw(/readFile/);
});
it('should throw an default error ', () => {
expect(() => ffmpeg.FS('unlink', '/invalid')).to.throw(/Oops/);
});
});