log-vault
Version:
A generator of Winston logger instance with pre-defined configurable transports and formats and extra functionality.
36 lines (35 loc) • 1.36 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const bullmq_1 = require("bullmq");
const Notificator_1 = require("./Notificator");
const NotificationChannel_1 = require("./channels/NotificationChannel");
const waitForProcess_1 = require("../test-files/util/waitForProcess");
describe("Notificator class tests", () => {
it("Notificator class", async () => {
const notificator = new Notificator_1.Notificator({
queueName: "test-notificator-queue"
});
class TestChannel extends NotificationChannel_1.NotificationChannel {
constructor(opts) {
super(opts);
this.process({
queueName: "test-nchannel-queue",
processor: async (job) => {
return job.data;
}
});
}
}
const testChannel = new TestChannel({ matchPatterns: [] });
notificator.add(testChannel);
const testQueue = new bullmq_1.Queue("test-notificator-queue");
testQueue.add("new-event", {
data: "test-data"
});
const processed = await (0, waitForProcess_1.waitForProcess)("test-nchannel-queue");
expect(processed).toEqual({
data: "test-data"
});
await notificator.stop();
});
});