chz-telegram-bot 0.7.13 → 0.7.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dtos/propertyProviderSets.d.ts +0 -1
- package/dist/dtos/propertyProviderSets.d.ts.map +1 -1
- package/dist/entities/actions/commandAction.d.ts +1 -1
- package/dist/entities/actions/commandAction.d.ts.map +1 -1
- package/dist/entities/actions/commandAction.js +2 -2
- package/dist/helpers/builders/commandActionBuilder.d.ts.map +1 -1
- package/dist/helpers/builders/commandActionBuilder.js +2 -3
- package/package.json +4 -1
- package/eslint.config.ts +0 -62
- package/src/builtin/helpAction.ts +0 -17
- package/src/dtos/chatHistoryMessage.ts +0 -22
- package/src/dtos/chatInfo.ts +0 -12
- package/src/dtos/commandTriggerCheckResult.ts +0 -40
- package/src/dtos/cooldownInfo.ts +0 -10
- package/src/dtos/incomingMessage.ts +0 -71
- package/src/dtos/incomingQuery.ts +0 -14
- package/src/dtos/messageInfo.ts +0 -15
- package/src/dtos/propertyProviderSets.ts +0 -21
- package/src/dtos/replyInfo.ts +0 -9
- package/src/dtos/responses/delay.ts +0 -28
- package/src/dtos/responses/imageMessage.ts +0 -41
- package/src/dtos/responses/inlineQueryResponse.ts +0 -26
- package/src/dtos/responses/reaction.ts +0 -30
- package/src/dtos/responses/textMessage.ts +0 -44
- package/src/dtos/responses/unpin.ts +0 -27
- package/src/dtos/responses/videoMessage.ts +0 -41
- package/src/dtos/userInfo.ts +0 -8
- package/src/entities/actions/commandAction.ts +0 -275
- package/src/entities/actions/inlineQueryAction.ts +0 -83
- package/src/entities/actions/replyCaptureAction.ts +0 -110
- package/src/entities/actions/scheduledAction.ts +0 -182
- package/src/entities/botInstance.ts +0 -92
- package/src/entities/cachedStateFactory.ts +0 -14
- package/src/entities/context/baseContext.ts +0 -111
- package/src/entities/context/chatContext.ts +0 -135
- package/src/entities/context/inlineQueryContext.ts +0 -63
- package/src/entities/context/messageContext.ts +0 -250
- package/src/entities/context/replyContext.ts +0 -260
- package/src/entities/states/actionStateBase.ts +0 -6
- package/src/entities/taskRecord.ts +0 -11
- package/src/helpers/builders/commandActionBuilder.ts +0 -214
- package/src/helpers/builders/inlineQueryActionBuilder.ts +0 -71
- package/src/helpers/builders/scheduledActionBuilder.ts +0 -143
- package/src/helpers/mapUtils.ts +0 -28
- package/src/helpers/noop.ts +0 -20
- package/src/helpers/objectFromEntries.ts +0 -7
- package/src/helpers/timeConvertions.ts +0 -13
- package/src/helpers/toArray.ts +0 -3
- package/src/helpers/traceFactory.ts +0 -11
- package/src/index.ts +0 -33
- package/src/main.ts +0 -76
- package/src/services/actionProcessingService.ts +0 -125
- package/src/services/actionProcessors/baseProcessor.ts +0 -67
- package/src/services/actionProcessors/commandActionProcessor.ts +0 -231
- package/src/services/actionProcessors/inlineQueryActionProcessor.ts +0 -165
- package/src/services/actionProcessors/scheduledActionProcessor.ts +0 -136
- package/src/services/jsonFileStorage.ts +0 -181
- package/src/services/nodeTimeoutScheduler.ts +0 -79
- package/src/services/responseProcessingQueue.ts +0 -57
- package/src/services/telegramApi.ts +0 -278
- package/src/types/action.ts +0 -15
- package/src/types/actionState.ts +0 -4
- package/src/types/cachedValueAccessor.ts +0 -1
- package/src/types/capture.ts +0 -33
- package/src/types/commandCondition.ts +0 -9
- package/src/types/commandTrigger.ts +0 -1
- package/src/types/events.ts +0 -286
- package/src/types/externalAliases.ts +0 -18
- package/src/types/handlers.ts +0 -26
- package/src/types/inputFile.ts +0 -4
- package/src/types/messageSendingOptions.ts +0 -10
- package/src/types/messageTypes.ts +0 -21
- package/src/types/propertyProvider.ts +0 -14
- package/src/types/response.ts +0 -51
- package/src/types/scheduler.ts +0 -20
- package/src/types/storage.ts +0 -23
- package/src/types/timeValues.ts +0 -33
- package/src/types/trace.ts +0 -5
- package/tests/dtos/commandTriggerCheckResult.test.ts +0 -301
- package/tests/entities/actions/inlineQueryAction.test.ts +0 -359
- package/tests/entities/actions/replyCaptureAction.test.ts +0 -501
- package/tests/entities/cachedStateFactory.test.ts +0 -98
- package/tests/entities/context/chatContext.test.ts +0 -606
- package/tests/entities/context/messageContext.test.ts +0 -370
- package/tests/entities/states/actionStateBase.test.ts +0 -138
- package/tests/entities/taskRecord.test.ts +0 -195
- package/tests/helpers/mapUtils.test.ts +0 -163
- package/tests/helpers/timeConvertions.test.ts +0 -129
- package/tests/services/actionProcessors/baseActionProcessor.test.ts +0 -359
- package/tests/services/actionProcessors/commandActionProcessor.test.ts +0 -268
- package/tests/services/actionProcessors/inlineQueryActionProcessor.test.ts +0 -616
- package/tests/services/actionProcessors/processorTestHelpers.ts +0 -147
- package/tests/services/actionProcessors/scheduledActionProcessor.test.ts +0 -153
- package/tests/services/jsonFileStorage.test.ts +0 -927
- package/tests/services/nodeTimeoutScheduler.test.ts +0 -421
- package/tests/services/responseProcessingQueue.test.ts +0 -388
- package/tsconfig.build.json +0 -8
- package/tsconfig.json +0 -118
|
@@ -1,421 +0,0 @@
|
|
|
1
|
-
import { describe, test, expect, beforeEach, afterEach } from 'bun:test';
|
|
2
|
-
import { NodeTimeoutScheduler } from '../../src/services/nodeTimeoutScheduler';
|
|
3
|
-
import { BotEventType, TypedEventEmitter } from '../../src/types/events';
|
|
4
|
-
import { Milliseconds } from '../../src/types/timeValues';
|
|
5
|
-
|
|
6
|
-
describe('NodeTimeoutScheduler', () => {
|
|
7
|
-
let scheduler: NodeTimeoutScheduler;
|
|
8
|
-
let eventEmitter: TypedEventEmitter;
|
|
9
|
-
|
|
10
|
-
const TEST_BOT_NAME = 'test-bot';
|
|
11
|
-
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
eventEmitter = new TypedEventEmitter();
|
|
14
|
-
scheduler = new NodeTimeoutScheduler(eventEmitter, TEST_BOT_NAME);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
afterEach(() => {
|
|
18
|
-
scheduler.stopAll();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
describe('constructor', () => {
|
|
22
|
-
test('should initialize with empty activeTasks array', () => {
|
|
23
|
-
expect(scheduler.activeTasks).toEqual([]);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
test('should store eventEmitter reference', () => {
|
|
27
|
-
expect(scheduler.eventEmitter).toBe(eventEmitter);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test('should store botName', () => {
|
|
31
|
-
expect(scheduler.botName).toBe(TEST_BOT_NAME);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
describe('createTask', () => {
|
|
36
|
-
test('should add task to activeTasks', () => {
|
|
37
|
-
scheduler.createTask(
|
|
38
|
-
'test-task',
|
|
39
|
-
() => {},
|
|
40
|
-
1000 as Milliseconds,
|
|
41
|
-
false,
|
|
42
|
-
'test-bot'
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
expect(scheduler.activeTasks.length).toBe(1);
|
|
46
|
-
expect(scheduler.activeTasks[0].name).toBe('test-task');
|
|
47
|
-
expect(scheduler.activeTasks[0].interval).toBe(
|
|
48
|
-
1000 as Milliseconds
|
|
49
|
-
);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
test('should emit taskCreated event', () => {
|
|
53
|
-
const createdEvents: unknown[] = [];
|
|
54
|
-
eventEmitter.on(BotEventType.taskCreated, (_timestamp, data) => {
|
|
55
|
-
createdEvents.push(data);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
scheduler.createTask(
|
|
59
|
-
'my-task',
|
|
60
|
-
() => {},
|
|
61
|
-
500 as Milliseconds,
|
|
62
|
-
false,
|
|
63
|
-
'owner-bot'
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
expect(createdEvents.length).toBe(1);
|
|
67
|
-
expect(createdEvents[0]).toMatchObject({
|
|
68
|
-
name: 'my-task',
|
|
69
|
-
ownerName: 'owner-bot',
|
|
70
|
-
interval: 500
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
test('should execute action immediately when executeRightAway is true', async () => {
|
|
75
|
-
let executed = false;
|
|
76
|
-
|
|
77
|
-
scheduler.createTask(
|
|
78
|
-
'immediate-task',
|
|
79
|
-
() => {
|
|
80
|
-
executed = true;
|
|
81
|
-
},
|
|
82
|
-
10000 as Milliseconds, // Long interval so it won't re-trigger
|
|
83
|
-
true,
|
|
84
|
-
'test-bot'
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
// Wait for setImmediate to execute
|
|
88
|
-
await new Promise((resolve) => setImmediate(resolve));
|
|
89
|
-
|
|
90
|
-
expect(executed).toBe(true);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
test('should not execute immediately when executeRightAway is false', async () => {
|
|
94
|
-
let executed = false;
|
|
95
|
-
|
|
96
|
-
scheduler.createTask(
|
|
97
|
-
'delayed-task',
|
|
98
|
-
() => {
|
|
99
|
-
executed = true;
|
|
100
|
-
},
|
|
101
|
-
10000 as Milliseconds,
|
|
102
|
-
false,
|
|
103
|
-
'test-bot'
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
// Wait a tick
|
|
107
|
-
await new Promise((resolve) => setImmediate(resolve));
|
|
108
|
-
|
|
109
|
-
expect(executed).toBe(false);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
test('should execute action on interval', async () => {
|
|
113
|
-
let executionCount = 0;
|
|
114
|
-
|
|
115
|
-
scheduler.createTask(
|
|
116
|
-
'interval-task',
|
|
117
|
-
() => {
|
|
118
|
-
executionCount++;
|
|
119
|
-
},
|
|
120
|
-
50 as Milliseconds,
|
|
121
|
-
false,
|
|
122
|
-
'test-bot'
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
// Wait for 2-3 intervals
|
|
126
|
-
await new Promise((resolve) => setTimeout(resolve, 130));
|
|
127
|
-
|
|
128
|
-
expect(executionCount).toBeGreaterThanOrEqual(2);
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
test('should emit taskRun event on each interval execution', async () => {
|
|
132
|
-
const runEvents: unknown[] = [];
|
|
133
|
-
eventEmitter.on(BotEventType.taskRun, (_timestamp, data) => {
|
|
134
|
-
runEvents.push(data);
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
scheduler.createTask(
|
|
138
|
-
'run-event-task',
|
|
139
|
-
() => {},
|
|
140
|
-
50 as Milliseconds,
|
|
141
|
-
false,
|
|
142
|
-
'test-bot'
|
|
143
|
-
);
|
|
144
|
-
|
|
145
|
-
await new Promise((resolve) => setTimeout(resolve, 130));
|
|
146
|
-
|
|
147
|
-
expect(runEvents.length).toBeGreaterThanOrEqual(2);
|
|
148
|
-
expect(runEvents[0]).toMatchObject({
|
|
149
|
-
name: 'run-event-task',
|
|
150
|
-
ownerName: 'test-bot',
|
|
151
|
-
interval: 50
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
test('should create multiple independent tasks', () => {
|
|
156
|
-
scheduler.createTask(
|
|
157
|
-
'task-1',
|
|
158
|
-
() => {},
|
|
159
|
-
100 as Milliseconds,
|
|
160
|
-
false,
|
|
161
|
-
'bot'
|
|
162
|
-
);
|
|
163
|
-
scheduler.createTask(
|
|
164
|
-
'task-2',
|
|
165
|
-
() => {},
|
|
166
|
-
200 as Milliseconds,
|
|
167
|
-
false,
|
|
168
|
-
'bot'
|
|
169
|
-
);
|
|
170
|
-
scheduler.createTask(
|
|
171
|
-
'task-3',
|
|
172
|
-
() => {},
|
|
173
|
-
300 as Milliseconds,
|
|
174
|
-
false,
|
|
175
|
-
'bot'
|
|
176
|
-
);
|
|
177
|
-
|
|
178
|
-
expect(scheduler.activeTasks.length).toBe(3);
|
|
179
|
-
expect(scheduler.activeTasks.map((t) => t.name)).toEqual([
|
|
180
|
-
'task-1',
|
|
181
|
-
'task-2',
|
|
182
|
-
'task-3'
|
|
183
|
-
]);
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
describe('createOnetimeTask', () => {
|
|
188
|
-
test('should emit taskCreated event with delay', () => {
|
|
189
|
-
const createdEvents: unknown[] = [];
|
|
190
|
-
eventEmitter.on(BotEventType.taskCreated, (_timestamp, data) => {
|
|
191
|
-
createdEvents.push(data);
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
scheduler.createOnetimeTask(
|
|
195
|
-
'onetime-task',
|
|
196
|
-
() => {},
|
|
197
|
-
100 as Milliseconds,
|
|
198
|
-
'test-bot'
|
|
199
|
-
);
|
|
200
|
-
|
|
201
|
-
expect(createdEvents.length).toBe(1);
|
|
202
|
-
expect(createdEvents[0]).toMatchObject({
|
|
203
|
-
name: 'onetime-task',
|
|
204
|
-
ownerName: 'test-bot',
|
|
205
|
-
delay: 100
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
test('should execute action after delay', async () => {
|
|
210
|
-
let executed = false;
|
|
211
|
-
|
|
212
|
-
scheduler.createOnetimeTask(
|
|
213
|
-
'delayed-onetime',
|
|
214
|
-
() => {
|
|
215
|
-
executed = true;
|
|
216
|
-
},
|
|
217
|
-
50 as Milliseconds,
|
|
218
|
-
'test-bot'
|
|
219
|
-
);
|
|
220
|
-
|
|
221
|
-
expect(executed).toBe(false);
|
|
222
|
-
|
|
223
|
-
await new Promise((resolve) => setTimeout(resolve, 80));
|
|
224
|
-
|
|
225
|
-
expect(executed).toBe(true);
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
test('should emit taskRun event when executed', async () => {
|
|
229
|
-
const runEvents: unknown[] = [];
|
|
230
|
-
eventEmitter.on(BotEventType.taskRun, (_timestamp, data) => {
|
|
231
|
-
runEvents.push(data);
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
scheduler.createOnetimeTask(
|
|
235
|
-
'run-once',
|
|
236
|
-
() => {},
|
|
237
|
-
50 as Milliseconds,
|
|
238
|
-
'test-bot'
|
|
239
|
-
);
|
|
240
|
-
|
|
241
|
-
await new Promise((resolve) => setTimeout(resolve, 80));
|
|
242
|
-
|
|
243
|
-
expect(runEvents.length).toBe(1);
|
|
244
|
-
expect(runEvents[0]).toMatchObject({
|
|
245
|
-
name: 'run-once',
|
|
246
|
-
ownerName: 'test-bot',
|
|
247
|
-
delay: 50
|
|
248
|
-
});
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
test('should not add to activeTasks (one-time tasks are not tracked)', () => {
|
|
252
|
-
scheduler.createOnetimeTask(
|
|
253
|
-
'not-tracked',
|
|
254
|
-
() => {},
|
|
255
|
-
100 as Milliseconds,
|
|
256
|
-
'test-bot'
|
|
257
|
-
);
|
|
258
|
-
|
|
259
|
-
// One-time tasks are not added to activeTasks
|
|
260
|
-
expect(scheduler.activeTasks.length).toBe(0);
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
test('should only execute once', async () => {
|
|
264
|
-
let executionCount = 0;
|
|
265
|
-
|
|
266
|
-
scheduler.createOnetimeTask(
|
|
267
|
-
'execute-once',
|
|
268
|
-
() => {
|
|
269
|
-
executionCount++;
|
|
270
|
-
},
|
|
271
|
-
30 as Milliseconds,
|
|
272
|
-
'test-bot'
|
|
273
|
-
);
|
|
274
|
-
|
|
275
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
276
|
-
|
|
277
|
-
expect(executionCount).toBe(1);
|
|
278
|
-
});
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
describe('stopAll', () => {
|
|
282
|
-
test('should clear all active interval tasks', async () => {
|
|
283
|
-
let task1Count = 0;
|
|
284
|
-
let task2Count = 0;
|
|
285
|
-
|
|
286
|
-
scheduler.createTask(
|
|
287
|
-
'task-1',
|
|
288
|
-
() => {
|
|
289
|
-
task1Count++;
|
|
290
|
-
},
|
|
291
|
-
30 as Milliseconds,
|
|
292
|
-
false,
|
|
293
|
-
'bot'
|
|
294
|
-
);
|
|
295
|
-
scheduler.createTask(
|
|
296
|
-
'task-2',
|
|
297
|
-
() => {
|
|
298
|
-
task2Count++;
|
|
299
|
-
},
|
|
300
|
-
30 as Milliseconds,
|
|
301
|
-
false,
|
|
302
|
-
'bot'
|
|
303
|
-
);
|
|
304
|
-
|
|
305
|
-
// Let them run a bit
|
|
306
|
-
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
307
|
-
|
|
308
|
-
const countBeforeStop1 = task1Count;
|
|
309
|
-
const countBeforeStop2 = task2Count;
|
|
310
|
-
|
|
311
|
-
scheduler.stopAll();
|
|
312
|
-
|
|
313
|
-
// Wait more time
|
|
314
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
315
|
-
|
|
316
|
-
// Counts should not have increased after stop
|
|
317
|
-
expect(task1Count).toBe(countBeforeStop1);
|
|
318
|
-
expect(task2Count).toBe(countBeforeStop2);
|
|
319
|
-
});
|
|
320
|
-
|
|
321
|
-
test('should handle being called with no tasks', () => {
|
|
322
|
-
expect(() => {
|
|
323
|
-
scheduler.stopAll();
|
|
324
|
-
}).not.toThrow();
|
|
325
|
-
});
|
|
326
|
-
|
|
327
|
-
test('should handle being called multiple times', () => {
|
|
328
|
-
scheduler.createTask(
|
|
329
|
-
'task',
|
|
330
|
-
() => {
|
|
331
|
-
/* no-op */
|
|
332
|
-
},
|
|
333
|
-
100 as Milliseconds,
|
|
334
|
-
false,
|
|
335
|
-
'bot'
|
|
336
|
-
);
|
|
337
|
-
|
|
338
|
-
expect(() => {
|
|
339
|
-
scheduler.stopAll();
|
|
340
|
-
scheduler.stopAll();
|
|
341
|
-
}).not.toThrow();
|
|
342
|
-
});
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
describe('IScheduler interface compliance', () => {
|
|
346
|
-
test('should implement stopAll method', () => {
|
|
347
|
-
expect(typeof scheduler.stopAll).toBe('function');
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
test('should implement createTask method', () => {
|
|
351
|
-
expect(typeof scheduler.createTask).toBe('function');
|
|
352
|
-
});
|
|
353
|
-
|
|
354
|
-
test('should implement createOnetimeTask method', () => {
|
|
355
|
-
expect(typeof scheduler.createOnetimeTask).toBe('function');
|
|
356
|
-
});
|
|
357
|
-
});
|
|
358
|
-
|
|
359
|
-
describe('real-world usage patterns', () => {
|
|
360
|
-
// Pattern: ScheduledActionProcessor creates recurring task for scheduled actions
|
|
361
|
-
test('should support scheduled action processor pattern', async () => {
|
|
362
|
-
const executions: string[] = [];
|
|
363
|
-
|
|
364
|
-
// Initial one-time task to align to hour boundary (simulated)
|
|
365
|
-
scheduler.createOnetimeTask(
|
|
366
|
-
'ScheduledProcessing_OneTime',
|
|
367
|
-
() => {
|
|
368
|
-
// Then create recurring task
|
|
369
|
-
scheduler.createTask(
|
|
370
|
-
'ScheduledProcessing',
|
|
371
|
-
() => {
|
|
372
|
-
executions.push('scheduled-run');
|
|
373
|
-
},
|
|
374
|
-
50 as Milliseconds,
|
|
375
|
-
true, // Execute right away
|
|
376
|
-
'test-bot'
|
|
377
|
-
);
|
|
378
|
-
},
|
|
379
|
-
20 as Milliseconds,
|
|
380
|
-
'test-bot'
|
|
381
|
-
);
|
|
382
|
-
|
|
383
|
-
await new Promise((resolve) => setTimeout(resolve, 150));
|
|
384
|
-
|
|
385
|
-
// Should have the recurring task in activeTasks
|
|
386
|
-
expect(
|
|
387
|
-
scheduler.activeTasks.some(
|
|
388
|
-
(t) => t.name === 'ScheduledProcessing'
|
|
389
|
-
)
|
|
390
|
-
).toBe(true);
|
|
391
|
-
// Should have executed multiple times
|
|
392
|
-
expect(executions.length).toBeGreaterThanOrEqual(2);
|
|
393
|
-
});
|
|
394
|
-
|
|
395
|
-
// Pattern: BotInstance uses scheduler and stops on shutdown
|
|
396
|
-
test('should support bot shutdown pattern', async () => {
|
|
397
|
-
let runCount = 0;
|
|
398
|
-
|
|
399
|
-
scheduler.createTask(
|
|
400
|
-
'ScheduledProcessing',
|
|
401
|
-
() => {
|
|
402
|
-
runCount++;
|
|
403
|
-
},
|
|
404
|
-
30 as Milliseconds,
|
|
405
|
-
false,
|
|
406
|
-
'test-bot'
|
|
407
|
-
);
|
|
408
|
-
|
|
409
|
-
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
410
|
-
const countBeforeShutdown = runCount;
|
|
411
|
-
|
|
412
|
-
// Simulate bot shutdown
|
|
413
|
-
scheduler.stopAll();
|
|
414
|
-
|
|
415
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
416
|
-
|
|
417
|
-
// No more executions after stop
|
|
418
|
-
expect(runCount).toBe(countBeforeShutdown);
|
|
419
|
-
});
|
|
420
|
-
});
|
|
421
|
-
});
|