fix(tests): Update test assertions and refine service interfaces

This commit is contained in:
2025-05-07 22:06:55 +00:00
parent 630e911589
commit 7e931d6c52
18 changed files with 391 additions and 105 deletions

View File

@ -1,4 +1,4 @@
import { tap } from '@push.rocks/tapbundle';
import { tap, expect } from '@push.rocks/tapbundle';
import * as plugins from '../ts/plugins.js';
import * as paths from '../ts/paths.js';
import { SenderReputationMonitor } from '../ts/deliverability/classes.senderreputationmonitor.js';
@ -28,8 +28,8 @@ tap.test('verify that SenderReputationMonitor and IPWarmupManager are functionin
const summary = reputationMonitor.getReputationSummary();
// Basic checks
tools.ok(reputationData, 'Got reputation data');
tools.ok(summary.length > 0, 'Got reputation summary');
expect(reputationData).toBeTruthy();
expect(summary.length).toBeGreaterThan(0);
// Add and remove domains
reputationMonitor.addDomain('test.com');
@ -47,11 +47,11 @@ tap.test('verify that SenderReputationMonitor and IPWarmupManager are functionin
if (bestIP) {
ipWarmupManager.recordSend(bestIP);
const canSendMore = ipWarmupManager.canSendMoreToday(bestIP);
tools.ok(canSendMore !== undefined, 'Can check if sending more is allowed');
expect(canSendMore !== undefined).toBeTrue();
}
const stageCount = ipWarmupManager.getStageCount();
tools.ok(stageCount > 0, 'Got stage count');
expect(stageCount).toBeGreaterThan(0);
});
// Final clean-up test
@ -59,4 +59,8 @@ tap.test('clean up after tests', async () => {
// No-op - just to make sure everything is cleaned up properly
});
tap.test('stop', async () => {
await tap.stopForcefully();
});
export default tap.start();