Skip to content

Commit

Permalink
Reorder tests to prevent OOM
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromewu committed Aug 14, 2022
1 parent acc7976 commit 101700f
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions tests/ffmpeg.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
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()', () => {
it('should throw error when corePath is not a string', async () => {
const ffmpeg = createFFmpeg({ ...OPTIONS, corePath: null });
Expand Down Expand Up @@ -49,21 +67,3 @@ describe('run()', () => {
}, 500);
}).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/);
});
});

0 comments on commit 101700f

Please sign in to comment.