MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / buildFixture

Function buildFixture

apps/api/tests/queues/queue-manager.test.ts:110–152  ·  view source on GitHub ↗
(withWebPush: boolean)

Source from the content-addressed store, hash-verified

108};
109
110const buildFixture = (withWebPush: boolean) => {
111 const accountMaintenance = makeQueueStub("account-maintenance");
112 const emailDelivery = makeQueueStub<IEmailDeliveryJobData>("email-delivery", {
113 waiting: 2,
114 failed: 1,
115 });
116 const notificationDispatch = makeQueueStub<INotificationDispatchJobData>(
117 "notification-dispatch"
118 );
119 const notificationMaintenance = makeQueueStub("notification-maintenance");
120 const webPushDelivery =
121 makeQueueStub<IWebPushDeliveryJobData>("web-push-delivery");
122 const workers = {
123 accountMaintenance: makeWorkerStub(),
124 emailDelivery: makeWorkerStub(),
125 notificationDispatch: makeWorkerStub(),
126 notificationMaintenance: makeWorkerStub(),
127 webPushDelivery: makeWorkerStub(),
128 };
129
130 const manager = new QueueManager({
131 accountMaintenanceQueue: accountMaintenance.stub,
132 accountMaintenanceWorker: workers.accountMaintenance.stub,
133 emailDeliveryQueue: emailDelivery.stub,
134 emailDeliveryWorker: workers.emailDelivery.stub,
135 notificationDispatchQueue: notificationDispatch.stub,
136 notificationDispatchWorker: workers.notificationDispatch.stub,
137 notificationMaintenanceQueue: notificationMaintenance.stub,
138 notificationMaintenanceWorker: workers.notificationMaintenance.stub,
139 webPushDeliveryQueue: withWebPush ? webPushDelivery.stub : null,
140 webPushDeliveryWorker: withWebPush ? workers.webPushDelivery.stub : null,
141 });
142
143 return {
144 manager,
145 accountMaintenance,
146 emailDelivery,
147 notificationDispatch,
148 notificationMaintenance,
149 webPushDelivery,
150 workers,
151 };
152};
153
154describe("QueueManager.enqueueEmailDelivery", () => {
155 test("adds the job with the retry envelope from the queue defaults", async () => {

Callers 1

Calls 2

makeQueueStubFunction · 0.85
makeWorkerStubFunction · 0.85

Tested by

no test coverage detected