UNPKG

874 BJavaScriptView Raw
1import fs from "node:fs";
2import process from "node:process";
3
4import { afterEach, beforeAll, describe, expect, it } from "vitest";
5
6import ffmpeg from "./ffmpeg.js";
7import util from "./util.js";
8
9describe("get/ffmpeg", function () {
10
11 let ffmpegFile = '';
12
13 afterEach(function () {
14 fs.promises.rm(ffmpegFile, { recursive: true, force: true });
15 });
16
17 beforeAll(async function () {
18 await fs.promises.mkdir("./test/fixture", { recursive: true });
19 });
20
21 it("downloades community prebuild FFmpeg for specifc platform", async function () {
22 ffmpegFile = await ffmpeg(
23 "https://github.com/nwjs-ffmpeg-prebuilt/nwjs-ffmpeg-prebuilt/releases/download",
24 "0.83.0",
25 util.PLATFORM_KV[process.platform],
26 util.ARCH_KV[process.arch],
27 "./test/fixture"
28 );
29 expect(util.fileExists(ffmpegFile)).resolves.toBe(true);
30 }, Infinity);
31});