* fixed blocking code on node addon * modify the example to run async * format * added logic to see the whisper output * added logic to see the whisper output * removed extra function for more clean example * fixed whisper test to new async implementation
23 lines
599 B
JavaScript
23 lines
599 B
JavaScript
const path = require("path");
|
|
const { whisper } = require(path.join(
|
|
__dirname,
|
|
"../../../build/Release/whisper-addon"
|
|
));
|
|
const { promisify } = require("util");
|
|
|
|
const whisperAsync = promisify(whisper);
|
|
|
|
const whisperParamsMock = {
|
|
language: "en",
|
|
model: path.join(__dirname, "../../../models/ggml-base.en.bin"),
|
|
fname_inp: path.join(__dirname, "../../../samples/jfk.wav"),
|
|
};
|
|
|
|
describe("Run whisper.node", () => {
|
|
test("it should receive a non-empty value", async () => {
|
|
let result = await whisperAsync(whisperParamsMock);
|
|
|
|
expect(result.length).toBeGreaterThan(0);
|
|
});
|
|
});
|