()
| 1 | const { AgentVM } = require('./src/index'); |
| 2 | |
| 3 | async function test() { |
| 4 | const vm = new AgentVM({ |
| 5 | mounts: { '/mnt/data': './test-mount' } |
| 6 | }); |
| 7 | await vm.start(); |
| 8 | |
| 9 | console.log('Test 1: ls /mnt/data (top level)...'); |
| 10 | let res = await vm.exec('ls /mnt/data'); |
| 11 | console.log('Result:', res.stdout); |
| 12 | |
| 13 | console.log('\nTest 2: ls /mnt/data/downloads (1 level nested)...'); |
| 14 | res = await vm.exec('ls /mnt/data/downloads'); |
| 15 | console.log('Result:', res.stdout); |
| 16 | |
| 17 | console.log('\nTest 3: ls /mnt/data/downloads/subdir (2 levels nested)...'); |
| 18 | res = await vm.exec('ls /mnt/data/downloads/subdir'); |
| 19 | console.log('Result:', res); |
| 20 | |
| 21 | console.log('\nTest 4: cat a nested file...'); |
| 22 | res = await vm.exec('cat /mnt/data/downloads/test-download.txt'); |
| 23 | console.log('Result:', res); |
| 24 | |
| 25 | await vm.stop(); |
| 26 | } |
| 27 | test().catch(e => { console.error('Error:', e); process.exit(1); }); |
no test coverage detected