UNPKG

log-vault

Version:

A generator of Winston logger instance with pre-defined configurable transports and formats and extra functionality.

33 lines (32 loc) 1.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const NotificationChannel_1 = require("./NotificationChannel"); const waitForProcess_1 = require("../../test-files/util/waitForProcess"); const redisCleanup_1 = require("../../test-files/util/redisCleanup"); describe("NotificationChannel class", () => { const queueName = "test-channel-queue"; beforeEach(async () => { await (0, redisCleanup_1.redisCleanup)(queueName); }); afterEach(async () => { await (0, redisCleanup_1.redisCleanup)(queueName); }); it("main notification channel class", async () => { class TestChannel extends NotificationChannel_1.NotificationChannel { constructor(opts) { super(opts); this.process({ queueName, processor: async (job) => job.data }); } } const testChannel = new TestChannel({ matchPatterns: [] }); // Await setup to ensure listener is ready before adding job const { completed } = await (0, waitForProcess_1.waitForProcess)(queueName); testChannel.addToQueue("something"); const res = await completed; expect(res).toEqual("something"); await testChannel.stop(); }); });