@dependabit/monitor 0.1.1

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.
Files changed (69) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/LICENSE +21 -0
  3. package/README.md +33 -0
  4. package/dist/checkers/github-repo.d.ts +17 -0
  5. package/dist/checkers/github-repo.d.ts.map +1 -0
  6. package/dist/checkers/github-repo.js +115 -0
  7. package/dist/checkers/github-repo.js.map +1 -0
  8. package/dist/checkers/index.d.ts +7 -0
  9. package/dist/checkers/index.d.ts.map +1 -0
  10. package/dist/checkers/index.js +7 -0
  11. package/dist/checkers/index.js.map +1 -0
  12. package/dist/checkers/openapi.d.ts +24 -0
  13. package/dist/checkers/openapi.d.ts.map +1 -0
  14. package/dist/checkers/openapi.js +221 -0
  15. package/dist/checkers/openapi.js.map +1 -0
  16. package/dist/checkers/url-content.d.ts +16 -0
  17. package/dist/checkers/url-content.d.ts.map +1 -0
  18. package/dist/checkers/url-content.js +66 -0
  19. package/dist/checkers/url-content.js.map +1 -0
  20. package/dist/comparator.d.ts +16 -0
  21. package/dist/comparator.d.ts.map +1 -0
  22. package/dist/comparator.js +53 -0
  23. package/dist/comparator.js.map +1 -0
  24. package/dist/index.d.ts +15 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +12 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/monitor.d.ts +43 -0
  29. package/dist/monitor.d.ts.map +1 -0
  30. package/dist/monitor.js +85 -0
  31. package/dist/monitor.js.map +1 -0
  32. package/dist/normalizer.d.ts +24 -0
  33. package/dist/normalizer.d.ts.map +1 -0
  34. package/dist/normalizer.js +97 -0
  35. package/dist/normalizer.js.map +1 -0
  36. package/dist/scheduler.d.ts +64 -0
  37. package/dist/scheduler.d.ts.map +1 -0
  38. package/dist/scheduler.js +132 -0
  39. package/dist/scheduler.js.map +1 -0
  40. package/dist/severity.d.ts +22 -0
  41. package/dist/severity.d.ts.map +1 -0
  42. package/dist/severity.js +87 -0
  43. package/dist/severity.js.map +1 -0
  44. package/dist/types.d.ts +36 -0
  45. package/dist/types.d.ts.map +1 -0
  46. package/dist/types.js +5 -0
  47. package/dist/types.js.map +1 -0
  48. package/package.json +39 -0
  49. package/src/checkers/github-repo.ts +150 -0
  50. package/src/checkers/index.ts +7 -0
  51. package/src/checkers/openapi.ts +310 -0
  52. package/src/checkers/url-content.ts +78 -0
  53. package/src/comparator.ts +68 -0
  54. package/src/index.ts +20 -0
  55. package/src/monitor.ts +120 -0
  56. package/src/normalizer.ts +122 -0
  57. package/src/scheduler.ts +175 -0
  58. package/src/severity.ts +112 -0
  59. package/src/types.ts +40 -0
  60. package/test/checkers/github-repo.test.ts +124 -0
  61. package/test/checkers/openapi.test.ts +352 -0
  62. package/test/checkers/url-content.test.ts +99 -0
  63. package/test/comparator.test.ts +108 -0
  64. package/test/monitor.test.ts +177 -0
  65. package/test/normalizer.test.ts +66 -0
  66. package/test/scheduler.test.ts +674 -0
  67. package/test/severity.test.ts +122 -0
  68. package/tsconfig.json +10 -0
  69. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,674 @@
1
+ import { describe, it, expect, beforeEach } from 'vitest';
2
+ import { Scheduler, type SchedulerOptions } from '../src/scheduler.js';
3
+ import type { DependencyEntry, DependabitConfig } from '@dependabit/manifest';
4
+
5
+ describe('Scheduler', () => {
6
+ let scheduler: Scheduler;
7
+ const now = new Date('2026-01-31T10:00:00Z');
8
+
9
+ beforeEach(() => {
10
+ scheduler = new Scheduler();
11
+ });
12
+
13
+ describe('shouldCheckDependency', () => {
14
+ it('should check dependency based on daily frequency', () => {
15
+ const dependency: DependencyEntry = {
16
+ id: '550e8400-e29b-41d4-a716-446655440000',
17
+ url: 'https://github.com/test/repo',
18
+ type: 'reference-implementation',
19
+ accessMethod: 'github-api',
20
+ name: 'Test',
21
+ currentStateHash: 'hash1',
22
+ detectionMethod: 'manual',
23
+ detectionConfidence: 1.0,
24
+ detectedAt: '2026-01-30T10:00:00Z',
25
+ lastChecked: '2026-01-30T10:00:00Z', // 24 hours ago
26
+ referencedIn: [],
27
+ changeHistory: [],
28
+ monitoring: {
29
+ enabled: true,
30
+ checkFrequency: 'daily',
31
+ ignoreChanges: false
32
+ }
33
+ };
34
+
35
+ const config: DependabitConfig = {
36
+ version: '1',
37
+ schedule: { interval: 'daily', timezone: 'UTC' }
38
+ };
39
+
40
+ const result = scheduler.shouldCheckDependency(dependency, config, now);
41
+
42
+ expect(result).toBe(true);
43
+ });
44
+
45
+ it('should not check dependency if checked recently', () => {
46
+ const dependency: DependencyEntry = {
47
+ id: '550e8400-e29b-41d4-a716-446655440000',
48
+ url: 'https://github.com/test/repo',
49
+ type: 'reference-implementation',
50
+ accessMethod: 'github-api',
51
+ name: 'Test',
52
+ currentStateHash: 'hash1',
53
+ detectionMethod: 'manual',
54
+ detectionConfidence: 1.0,
55
+ detectedAt: '2026-01-31T09:00:00Z',
56
+ lastChecked: '2026-01-31T09:00:00Z', // 1 hour ago
57
+ referencedIn: [],
58
+ changeHistory: [],
59
+ monitoring: {
60
+ enabled: true,
61
+ checkFrequency: 'daily',
62
+ ignoreChanges: false
63
+ }
64
+ };
65
+
66
+ const config: DependabitConfig = {
67
+ version: '1',
68
+ schedule: { interval: 'daily', timezone: 'UTC' }
69
+ };
70
+
71
+ const result = scheduler.shouldCheckDependency(dependency, config, now);
72
+
73
+ expect(result).toBe(false);
74
+ });
75
+
76
+ it('should respect hourly frequency', () => {
77
+ const dependency: DependencyEntry = {
78
+ id: '550e8400-e29b-41d4-a716-446655440000',
79
+ url: 'https://github.com/test/repo',
80
+ type: 'reference-implementation',
81
+ accessMethod: 'github-api',
82
+ name: 'Test',
83
+ currentStateHash: 'hash1',
84
+ detectionMethod: 'manual',
85
+ detectionConfidence: 1.0,
86
+ detectedAt: '2026-01-31T08:00:00Z',
87
+ lastChecked: '2026-01-31T08:00:00Z', // 2 hours ago
88
+ referencedIn: [],
89
+ changeHistory: [],
90
+ monitoring: {
91
+ enabled: true,
92
+ checkFrequency: 'hourly',
93
+ ignoreChanges: false
94
+ }
95
+ };
96
+
97
+ const config: DependabitConfig = {
98
+ version: '1',
99
+ schedule: { interval: 'daily', timezone: 'UTC' }
100
+ };
101
+
102
+ const result = scheduler.shouldCheckDependency(dependency, config, now);
103
+
104
+ expect(result).toBe(true);
105
+ });
106
+
107
+ it('should respect weekly frequency', () => {
108
+ const dependency: DependencyEntry = {
109
+ id: '550e8400-e29b-41d4-a716-446655440000',
110
+ url: 'https://github.com/test/repo',
111
+ type: 'reference-implementation',
112
+ accessMethod: 'github-api',
113
+ name: 'Test',
114
+ currentStateHash: 'hash1',
115
+ detectionMethod: 'manual',
116
+ detectionConfidence: 1.0,
117
+ detectedAt: '2026-01-24T10:00:00Z',
118
+ lastChecked: '2026-01-24T10:00:00Z', // 7 days ago
119
+ referencedIn: [],
120
+ changeHistory: [],
121
+ monitoring: {
122
+ enabled: true,
123
+ checkFrequency: 'weekly',
124
+ ignoreChanges: false
125
+ }
126
+ };
127
+
128
+ const config: DependabitConfig = {
129
+ version: '1',
130
+ schedule: { interval: 'daily', timezone: 'UTC' }
131
+ };
132
+
133
+ const result = scheduler.shouldCheckDependency(dependency, config, now);
134
+
135
+ expect(result).toBe(true);
136
+ });
137
+
138
+ it('should respect monthly frequency', () => {
139
+ const dependency: DependencyEntry = {
140
+ id: '550e8400-e29b-41d4-a716-446655440000',
141
+ url: 'https://github.com/test/repo',
142
+ type: 'reference-implementation',
143
+ accessMethod: 'github-api',
144
+ name: 'Test',
145
+ currentStateHash: 'hash1',
146
+ detectionMethod: 'manual',
147
+ detectionConfidence: 1.0,
148
+ detectedAt: '2025-12-31T10:00:00Z',
149
+ lastChecked: '2025-12-31T10:00:00Z', // 31 days ago
150
+ referencedIn: [],
151
+ changeHistory: [],
152
+ monitoring: {
153
+ enabled: true,
154
+ checkFrequency: 'monthly',
155
+ ignoreChanges: false
156
+ }
157
+ };
158
+
159
+ const config: DependabitConfig = {
160
+ version: '1',
161
+ schedule: { interval: 'daily', timezone: 'UTC' }
162
+ };
163
+
164
+ const result = scheduler.shouldCheckDependency(dependency, config, now);
165
+
166
+ expect(result).toBe(true);
167
+ });
168
+
169
+ it('should not check disabled dependencies', () => {
170
+ const dependency: DependencyEntry = {
171
+ id: '550e8400-e29b-41d4-a716-446655440000',
172
+ url: 'https://github.com/test/repo',
173
+ type: 'reference-implementation',
174
+ accessMethod: 'github-api',
175
+ name: 'Test',
176
+ currentStateHash: 'hash1',
177
+ detectionMethod: 'manual',
178
+ detectionConfidence: 1.0,
179
+ detectedAt: '2026-01-30T10:00:00Z',
180
+ lastChecked: '2026-01-30T10:00:00Z',
181
+ referencedIn: [],
182
+ changeHistory: [],
183
+ monitoring: {
184
+ enabled: false,
185
+ checkFrequency: 'daily',
186
+ ignoreChanges: false
187
+ }
188
+ };
189
+
190
+ const config: DependabitConfig = {
191
+ version: '1',
192
+ schedule: { interval: 'daily', timezone: 'UTC' }
193
+ };
194
+
195
+ const result = scheduler.shouldCheckDependency(dependency, config, now);
196
+
197
+ expect(result).toBe(false);
198
+ });
199
+
200
+ it('should apply config overrides for check frequency', () => {
201
+ const dependency: DependencyEntry = {
202
+ id: '550e8400-e29b-41d4-a716-446655440000',
203
+ url: 'https://github.com/test/repo',
204
+ type: 'reference-implementation',
205
+ accessMethod: 'github-api',
206
+ name: 'Test',
207
+ currentStateHash: 'hash1',
208
+ detectionMethod: 'manual',
209
+ detectionConfidence: 1.0,
210
+ detectedAt: '2026-01-31T08:00:00Z',
211
+ lastChecked: '2026-01-31T08:00:00Z', // 2 hours ago
212
+ referencedIn: [],
213
+ changeHistory: []
214
+ // No monitoring specified in dependency
215
+ };
216
+
217
+ const config: DependabitConfig = {
218
+ version: '1',
219
+ schedule: { interval: 'daily', timezone: 'UTC' },
220
+ dependencies: [
221
+ {
222
+ url: 'https://github.com/test/repo',
223
+ monitoring: {
224
+ enabled: true,
225
+ checkFrequency: 'hourly',
226
+ ignoreChanges: false
227
+ }
228
+ }
229
+ ]
230
+ };
231
+
232
+ const result = scheduler.shouldCheckDependency(dependency, config, now);
233
+
234
+ expect(result).toBe(true);
235
+ });
236
+
237
+ it('should skip dependencies with ignoreChanges flag', () => {
238
+ const dependency: DependencyEntry = {
239
+ id: '550e8400-e29b-41d4-a716-446655440000',
240
+ url: 'https://github.com/test/repo',
241
+ type: 'reference-implementation',
242
+ accessMethod: 'github-api',
243
+ name: 'Test',
244
+ currentStateHash: 'hash1',
245
+ detectionMethod: 'manual',
246
+ detectionConfidence: 1.0,
247
+ detectedAt: '2026-01-30T10:00:00Z',
248
+ lastChecked: '2026-01-30T10:00:00Z',
249
+ referencedIn: [],
250
+ changeHistory: [],
251
+ monitoring: {
252
+ enabled: true,
253
+ checkFrequency: 'daily',
254
+ ignoreChanges: true
255
+ }
256
+ };
257
+
258
+ const config: DependabitConfig = {
259
+ version: '1',
260
+ schedule: { interval: 'daily', timezone: 'UTC' }
261
+ };
262
+
263
+ const result = scheduler.shouldCheckDependency(dependency, config, now);
264
+
265
+ expect(result).toBe(false);
266
+ });
267
+ });
268
+
269
+ describe('filterDependenciesToCheck', () => {
270
+ it('should filter dependencies based on schedule', () => {
271
+ const dependencies: DependencyEntry[] = [
272
+ {
273
+ id: '550e8400-e29b-41d4-a716-446655440001',
274
+ url: 'https://github.com/test/repo1',
275
+ type: 'reference-implementation',
276
+ accessMethod: 'github-api',
277
+ name: 'Test1',
278
+ currentStateHash: 'hash1',
279
+ detectionMethod: 'manual',
280
+ detectionConfidence: 1.0,
281
+ detectedAt: '2026-01-30T10:00:00Z',
282
+ lastChecked: '2026-01-30T10:00:00Z', // Should check
283
+ referencedIn: [],
284
+ changeHistory: [],
285
+ monitoring: {
286
+ enabled: true,
287
+ checkFrequency: 'daily',
288
+ ignoreChanges: false
289
+ }
290
+ },
291
+ {
292
+ id: '550e8400-e29b-41d4-a716-446655440002',
293
+ url: 'https://github.com/test/repo2',
294
+ type: 'reference-implementation',
295
+ accessMethod: 'github-api',
296
+ name: 'Test2',
297
+ currentStateHash: 'hash2',
298
+ detectionMethod: 'manual',
299
+ detectionConfidence: 1.0,
300
+ detectedAt: '2026-01-31T09:30:00Z',
301
+ lastChecked: '2026-01-31T09:30:00Z', // Too recent
302
+ referencedIn: [],
303
+ changeHistory: [],
304
+ monitoring: {
305
+ enabled: true,
306
+ checkFrequency: 'daily',
307
+ ignoreChanges: false
308
+ }
309
+ },
310
+ {
311
+ id: '550e8400-e29b-41d4-a716-446655440003',
312
+ url: 'https://github.com/test/repo3',
313
+ type: 'reference-implementation',
314
+ accessMethod: 'github-api',
315
+ name: 'Test3',
316
+ currentStateHash: 'hash3',
317
+ detectionMethod: 'manual',
318
+ detectionConfidence: 1.0,
319
+ detectedAt: '2026-01-30T10:00:00Z',
320
+ lastChecked: '2026-01-30T10:00:00Z',
321
+ referencedIn: [],
322
+ changeHistory: [],
323
+ monitoring: {
324
+ enabled: false, // Disabled
325
+ checkFrequency: 'daily',
326
+ ignoreChanges: false
327
+ }
328
+ }
329
+ ];
330
+
331
+ const config: DependabitConfig = {
332
+ version: '1',
333
+ schedule: { interval: 'daily', timezone: 'UTC' }
334
+ };
335
+
336
+ const result = scheduler.filterDependenciesToCheck(dependencies, config, now);
337
+
338
+ expect(result).toHaveLength(1);
339
+ expect(result[0].id).toBe('550e8400-e29b-41d4-a716-446655440001');
340
+ });
341
+ });
342
+
343
+ describe('getNextCheckTime', () => {
344
+ it('should calculate next check time for daily frequency', () => {
345
+ const dependency: DependencyEntry = {
346
+ id: '550e8400-e29b-41d4-a716-446655440000',
347
+ url: 'https://github.com/test/repo',
348
+ type: 'reference-implementation',
349
+ accessMethod: 'github-api',
350
+ name: 'Test',
351
+ currentStateHash: 'hash1',
352
+ detectionMethod: 'manual',
353
+ detectionConfidence: 1.0,
354
+ detectedAt: '2026-01-31T10:00:00Z',
355
+ lastChecked: '2026-01-31T10:00:00Z',
356
+ referencedIn: [],
357
+ changeHistory: [],
358
+ monitoring: {
359
+ enabled: true,
360
+ checkFrequency: 'daily',
361
+ ignoreChanges: false
362
+ }
363
+ };
364
+
365
+ const config: DependabitConfig = {
366
+ version: '1',
367
+ schedule: { interval: 'daily', timezone: 'UTC' }
368
+ };
369
+
370
+ const result = scheduler.getNextCheckTime(dependency, config);
371
+ const expected = new Date('2026-02-01T10:00:00Z'); // 24 hours later
372
+
373
+ expect(result.getTime()).toBe(expected.getTime());
374
+ });
375
+
376
+ it('should respect dependency-level checkFrequency over config', () => {
377
+ const dependency: DependencyEntry = {
378
+ id: '550e8400-e29b-41d4-a716-446655440000',
379
+ url: 'https://github.com/test/repo',
380
+ type: 'reference-implementation',
381
+ accessMethod: 'github-api',
382
+ name: 'Test',
383
+ currentStateHash: 'hash1',
384
+ detectionMethod: 'manual',
385
+ detectionConfidence: 1.0,
386
+ detectedAt: '2026-01-31T10:00:00Z',
387
+ lastChecked: '2026-01-31T10:00:00Z',
388
+ referencedIn: [],
389
+ changeHistory: [],
390
+ monitoring: {
391
+ enabled: true,
392
+ checkFrequency: 'hourly', // Dependency level
393
+ ignoreChanges: false
394
+ }
395
+ };
396
+
397
+ const config: DependabitConfig = {
398
+ version: '1',
399
+ schedule: { interval: 'daily', timezone: 'UTC' } // Config level
400
+ };
401
+
402
+ const result = scheduler.getNextCheckTime(dependency, config);
403
+ const expected = new Date('2026-01-31T11:00:00Z'); // 1 hour later (respects dependency level)
404
+
405
+ expect(result.getTime()).toBe(expected.getTime());
406
+ });
407
+
408
+ it('should use config-level frequency when dependency has no monitoring', () => {
409
+ const dependency: DependencyEntry = {
410
+ id: '550e8400-e29b-41d4-a716-446655440000',
411
+ url: 'https://github.com/test/repo',
412
+ type: 'reference-implementation',
413
+ accessMethod: 'github-api',
414
+ name: 'Test',
415
+ currentStateHash: 'hash1',
416
+ detectionMethod: 'manual',
417
+ detectionConfidence: 1.0,
418
+ detectedAt: '2026-01-31T10:00:00Z',
419
+ lastChecked: '2026-01-31T10:00:00Z',
420
+ referencedIn: [],
421
+ changeHistory: []
422
+ // No monitoring specified
423
+ };
424
+
425
+ const config: DependabitConfig = {
426
+ version: '1',
427
+ schedule: { interval: 'weekly', timezone: 'UTC' }
428
+ };
429
+
430
+ const result = scheduler.getNextCheckTime(dependency, config);
431
+ const expected = new Date('2026-02-07T10:00:00Z'); // 7 days later
432
+
433
+ expect(result.getTime()).toBe(expected.getTime());
434
+ });
435
+
436
+ it('should apply config overrides when dependency has no monitoring', () => {
437
+ const dependency: DependencyEntry = {
438
+ id: '550e8400-e29b-41d4-a716-446655440000',
439
+ url: 'https://github.com/test/repo',
440
+ type: 'reference-implementation',
441
+ accessMethod: 'github-api',
442
+ name: 'Test',
443
+ currentStateHash: 'hash1',
444
+ detectionMethod: 'manual',
445
+ detectionConfidence: 1.0,
446
+ detectedAt: '2026-01-31T10:00:00Z',
447
+ lastChecked: '2026-01-31T10:00:00Z',
448
+ referencedIn: [],
449
+ changeHistory: []
450
+ };
451
+
452
+ const config: DependabitConfig = {
453
+ version: '1',
454
+ schedule: { interval: 'daily', timezone: 'UTC' },
455
+ dependencies: [
456
+ {
457
+ url: 'https://github.com/test/repo',
458
+ monitoring: {
459
+ enabled: true,
460
+ checkFrequency: 'monthly',
461
+ ignoreChanges: false
462
+ }
463
+ }
464
+ ]
465
+ };
466
+
467
+ const result = scheduler.getNextCheckTime(dependency, config);
468
+ const lastChecked = new Date('2026-01-31T10:00:00Z');
469
+ const expected = new Date(lastChecked.getTime() + 30 * 24 * 60 * 60 * 1000); // 30 days later (scheduler's monthly approximation)
470
+
471
+ expect(result.getTime()).toBe(expected.getTime());
472
+ });
473
+ });
474
+
475
+ describe('getScheduleSummary', () => {
476
+ it('should count dependencies by frequency type', () => {
477
+ const dependencies: DependencyEntry[] = [
478
+ {
479
+ id: '550e8400-e29b-41d4-a716-446655440001',
480
+ url: 'https://github.com/test/repo1',
481
+ type: 'reference-implementation',
482
+ accessMethod: 'github-api',
483
+ name: 'Test1',
484
+ currentStateHash: 'hash1',
485
+ detectionMethod: 'manual',
486
+ detectionConfidence: 1.0,
487
+ detectedAt: '2026-01-31T10:00:00Z',
488
+ lastChecked: '2026-01-31T10:00:00Z',
489
+ referencedIn: [],
490
+ changeHistory: [],
491
+ monitoring: {
492
+ enabled: true,
493
+ checkFrequency: 'hourly',
494
+ ignoreChanges: false
495
+ }
496
+ },
497
+ {
498
+ id: '550e8400-e29b-41d4-a716-446655440002',
499
+ url: 'https://github.com/test/repo2',
500
+ type: 'reference-implementation',
501
+ accessMethod: 'github-api',
502
+ name: 'Test2',
503
+ currentStateHash: 'hash2',
504
+ detectionMethod: 'manual',
505
+ detectionConfidence: 1.0,
506
+ detectedAt: '2026-01-31T10:00:00Z',
507
+ lastChecked: '2026-01-31T10:00:00Z',
508
+ referencedIn: [],
509
+ changeHistory: [],
510
+ monitoring: {
511
+ enabled: true,
512
+ checkFrequency: 'daily',
513
+ ignoreChanges: false
514
+ }
515
+ },
516
+ {
517
+ id: '550e8400-e29b-41d4-a716-446655440003',
518
+ url: 'https://github.com/test/repo3',
519
+ type: 'reference-implementation',
520
+ accessMethod: 'github-api',
521
+ name: 'Test3',
522
+ currentStateHash: 'hash3',
523
+ detectionMethod: 'manual',
524
+ detectionConfidence: 1.0,
525
+ detectedAt: '2026-01-31T10:00:00Z',
526
+ lastChecked: '2026-01-31T10:00:00Z',
527
+ referencedIn: [],
528
+ changeHistory: [],
529
+ monitoring: {
530
+ enabled: true,
531
+ checkFrequency: 'weekly',
532
+ ignoreChanges: false
533
+ }
534
+ }
535
+ ];
536
+
537
+ const config: DependabitConfig = {
538
+ version: '1',
539
+ schedule: { interval: 'daily', timezone: 'UTC' }
540
+ };
541
+
542
+ const result = scheduler.getScheduleSummary(dependencies, config);
543
+
544
+ expect(result.hourly).toBe(1);
545
+ expect(result.daily).toBe(1);
546
+ expect(result.weekly).toBe(1);
547
+ expect(result.monthly).toBe(0);
548
+ expect(result.disabled).toBe(0);
549
+ });
550
+
551
+ it('should count disabled dependencies', () => {
552
+ const dependencies: DependencyEntry[] = [
553
+ {
554
+ id: '550e8400-e29b-41d4-a716-446655440001',
555
+ url: 'https://github.com/test/repo1',
556
+ type: 'reference-implementation',
557
+ accessMethod: 'github-api',
558
+ name: 'Test1',
559
+ currentStateHash: 'hash1',
560
+ detectionMethod: 'manual',
561
+ detectionConfidence: 1.0,
562
+ detectedAt: '2026-01-31T10:00:00Z',
563
+ lastChecked: '2026-01-31T10:00:00Z',
564
+ referencedIn: [],
565
+ changeHistory: [],
566
+ monitoring: {
567
+ enabled: false,
568
+ checkFrequency: 'daily',
569
+ ignoreChanges: false
570
+ }
571
+ }
572
+ ];
573
+
574
+ const config: DependabitConfig = {
575
+ version: '1',
576
+ schedule: { interval: 'daily', timezone: 'UTC' }
577
+ };
578
+
579
+ const result = scheduler.getScheduleSummary(dependencies, config);
580
+
581
+ expect(result.disabled).toBe(1);
582
+ expect(result.daily).toBe(0);
583
+ });
584
+
585
+ it('should count dependencies with ignoreChanges as disabled', () => {
586
+ const dependencies: DependencyEntry[] = [
587
+ {
588
+ id: '550e8400-e29b-41d4-a716-446655440001',
589
+ url: 'https://github.com/test/repo1',
590
+ type: 'reference-implementation',
591
+ accessMethod: 'github-api',
592
+ name: 'Test1',
593
+ currentStateHash: 'hash1',
594
+ detectionMethod: 'manual',
595
+ detectionConfidence: 1.0,
596
+ detectedAt: '2026-01-31T10:00:00Z',
597
+ lastChecked: '2026-01-31T10:00:00Z',
598
+ referencedIn: [],
599
+ changeHistory: [],
600
+ monitoring: {
601
+ enabled: true,
602
+ checkFrequency: 'daily',
603
+ ignoreChanges: true
604
+ }
605
+ }
606
+ ];
607
+
608
+ const config: DependabitConfig = {
609
+ version: '1',
610
+ schedule: { interval: 'daily', timezone: 'UTC' }
611
+ };
612
+
613
+ const result = scheduler.getScheduleSummary(dependencies, config);
614
+
615
+ expect(result.disabled).toBe(1);
616
+ expect(result.daily).toBe(0);
617
+ });
618
+
619
+ it('should handle empty dependency list', () => {
620
+ const config: DependabitConfig = {
621
+ version: '1',
622
+ schedule: { interval: 'daily', timezone: 'UTC' }
623
+ };
624
+
625
+ const result = scheduler.getScheduleSummary([], config);
626
+
627
+ expect(result.hourly).toBe(0);
628
+ expect(result.daily).toBe(0);
629
+ expect(result.weekly).toBe(0);
630
+ expect(result.monthly).toBe(0);
631
+ expect(result.disabled).toBe(0);
632
+ });
633
+
634
+ it('should apply config overrides', () => {
635
+ const dependencies: DependencyEntry[] = [
636
+ {
637
+ id: '550e8400-e29b-41d4-a716-446655440001',
638
+ url: 'https://github.com/test/repo1',
639
+ type: 'reference-implementation',
640
+ accessMethod: 'github-api',
641
+ name: 'Test1',
642
+ currentStateHash: 'hash1',
643
+ detectionMethod: 'manual',
644
+ detectionConfidence: 1.0,
645
+ detectedAt: '2026-01-31T10:00:00Z',
646
+ lastChecked: '2026-01-31T10:00:00Z',
647
+ referencedIn: [],
648
+ changeHistory: []
649
+ // No monitoring specified
650
+ }
651
+ ];
652
+
653
+ const config: DependabitConfig = {
654
+ version: '1',
655
+ schedule: { interval: 'daily', timezone: 'UTC' },
656
+ dependencies: [
657
+ {
658
+ url: 'https://github.com/test/repo1',
659
+ monitoring: {
660
+ enabled: true,
661
+ checkFrequency: 'weekly',
662
+ ignoreChanges: false
663
+ }
664
+ }
665
+ ]
666
+ };
667
+
668
+ const result = scheduler.getScheduleSummary(dependencies, config);
669
+
670
+ expect(result.weekly).toBe(1);
671
+ expect(result.daily).toBe(0);
672
+ });
673
+ });
674
+ });