import { expect, tap } from '../ts/plugins.js'; import * as smartantivirus from '../ts/index.js'; import { setupClamAV, cleanupClamAV } from './helpers/clamav.helper.js'; const EICAR_TEST_STRING = 'X5O!P%@AP[4\\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'; let clamService: smartantivirus.ClamAvService; tap.test('setup', async () => { await setupClamAV(); }); tap.test('should create a ClamAvService instance and initialize ClamAV', async () => { clamService = new smartantivirus.ClamAvService(); expect(clamService).toBeTruthy(); // The manager will start the container and wait for initialization await clamService.verifyConnection(); }); tap.test('should detect EICAR test string', async () => { const scanResult = await clamService.scanString(EICAR_TEST_STRING); console.log('Scan Result:', scanResult); expect(scanResult.isInfected).toEqual(true); expect(scanResult.reason).toBeTruthy(); }); tap.test('should not detect clean string', async () => { const scanResult = await clamService.scanString('This is a clean string with no virus signature'); console.log('Clean Scan Result:', scanResult); expect(scanResult.isInfected).toEqual(false); expect(scanResult.reason).toBeUndefined(); }); tap.test('cleanup', async () => { await cleanupClamAV(); }); tap.start();