Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
thijstriemstra committed Jan 30, 2021
1 parent b7bb0ee commit e561be4
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions test/plugins/ffmpeg-wasm-plugin.spec.js
@@ -0,0 +1,48 @@
/**
* @since 4.2.0
*/

import TestHelpers from '../test-helpers';

// registers the plugin
import FFmpegjsEngine from '../../src/js/plugins/ffmpegjs-plugin';
import {FFMPEGJS} from '../../src/js/engine/convert-engine';

/** @test {FFmpegjsEngine} */
describe('plugins.ffmpegjs-plugin', () => {
let player;

beforeEach(() => {
// create video-only player with ffmpeg.js plugin
player = TestHelpers.makeConvertPluginPlayer(FFMPEGJS);
});

afterEach(() => {
player.dispose();
});

/** @test {FFmpegjsEngine} */
it('converts', (done) => {
// allow test to fail
pending('disabled until test runner failure is figured out');

player.one('deviceReady', () => {
let req = new Request(TestHelpers.TEST_WEBM);
fetch(req).then((response) => {
return response.blob();
}).then((blob) => {
player.one('finishConvert', () => {
expect(player.convertedData instanceof Blob).toBeTruthy();
expect(player.convertedData.name).toEndWith('.mp3');
done();
});
player.record().converter.convert(blob);
});
});

player.one('ready', () => {
// start device
player.record().getDevice();
});
});
});

0 comments on commit e561be4

Please sign in to comment.