2025-01-10 03:09:32 +01:00

36 lines
1004 B
TypeScript

import { expect, expectAsync, tap } from '@push.rocks/tapbundle';
import * as smartantivirus from '../ts/index.js';
let clamService: smartantivirus.ClamAvService;
tap.test('should create a ClamAvService instance', async () => {
clamService = new smartantivirus.ClamAvService();
expect(clamService).toBeDefined();
});
tap.test('should scan a string', async () => {
const scanResult = await clamService.scanString('X5O!P%@AP[4\PZX54(P^)7CC)7}' + '$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*');
console.log('Scan Result:', scanResult);
// expect(scanResult).toEqual({ isInfected: true, reason: 'FOUND' });
});
tap.start();
/* (async () => {
try {
await clamService.updateVirusDefinitions(); // Step 2: Update definitions
await clamService.startClamDaemon(); // Step 3: Start daemon
const scanResult = await clamService.scanString('EICAR test string...');
console.log('Scan Result:', scanResult);
} catch (error) {
console.error('Error:', error);
}
})(); */