2023-03-29 20:59:17 +00:00
|
|
|
const path = require("path");
|
|
|
|
const { whisper } = require(path.join(
|
|
|
|
__dirname,
|
2024-05-02 21:52:55 +00:00
|
|
|
"../../../build/Release/addon.node"
|
2023-03-29 20:59:17 +00:00
|
|
|
));
|
|
|
|
const { promisify } = require("util");
|
|
|
|
|
|
|
|
const whisperAsync = promisify(whisper);
|
2023-02-05 13:02:08 +00:00
|
|
|
|
|
|
|
const whisperParamsMock = {
|
2023-03-29 20:59:17 +00:00
|
|
|
language: "en",
|
|
|
|
model: path.join(__dirname, "../../../models/ggml-base.en.bin"),
|
|
|
|
fname_inp: path.join(__dirname, "../../../samples/jfk.wav"),
|
2023-11-06 09:04:24 +00:00
|
|
|
use_gpu: true,
|
2024-05-13 12:15:43 +00:00
|
|
|
no_prints: true,
|
|
|
|
comma_in_time: false,
|
|
|
|
translate: true,
|
2024-05-02 21:52:55 +00:00
|
|
|
no_timestamps: false,
|
2024-05-13 12:22:23 +00:00
|
|
|
audio_ctx: 0,
|
2023-02-05 13:02:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
describe("Run whisper.node", () => {
|
2023-04-30 15:51:57 +00:00
|
|
|
test("it should receive a non-empty value", async () => {
|
|
|
|
let result = await whisperAsync(whisperParamsMock);
|
2023-02-05 13:02:08 +00:00
|
|
|
|
2023-04-30 15:51:57 +00:00
|
|
|
expect(result.length).toBeGreaterThan(0);
|
|
|
|
}, 10000);
|
2023-02-05 13:02:08 +00:00
|
|
|
});
|
2023-04-30 15:51:57 +00:00
|
|
|
|