This commit is contained in:
2026-06-25 13:43:12 -05:00
parent dfc2c9b475
commit d8342a6475
9 changed files with 395 additions and 31 deletions

View File

@@ -43,10 +43,25 @@ test('filterSummaryVms scans the full VM summary list for VM-name filters', () =
...Array.from({ length: 900 }, (_, index) => ({ vm: `vm-${index}`, name: `ZZZ-${index}` })),
{ vm: 'vm-901', name: 'MCS-WIN-APP01' }
];
const matched = filterSummaryVms(vms, { field: 'name', operator: 'contains', value: 'MCS' });
const result = filterSummaryVms(vms, { field: 'name', operator: 'contains', value: 'MCS' });
assert.equal(matched.length, 1);
assert.equal(matched[0].name, 'MCS-WIN-APP01');
assert.equal(result.summaryFilterApplied, true);
assert.equal(result.summaryMatched, 1);
assert.equal(result.vms.length, 1);
assert.equal(result.vms[0].name, 'MCS-WIN-APP01');
});
test('filterSummaryVms prefilters hostname searches by VM name and falls back when needed', () => {
const vms = [{ vm: 'vm-1', name: 'MCS-WIN-APP01' }, { vm: 'vm-2', name: 'SQL-01' }];
const matched = filterSummaryVms(vms, { field: 'hostname', operator: 'contains', value: 'MCS' });
const fallback = filterSummaryVms(vms, { field: 'hostname', operator: 'contains', value: 'guest-only-name' });
assert.equal(matched.summaryMatched, 1);
assert.equal(matched.summaryFilterFallback, false);
assert.deepEqual(matched.vms.map((vm) => vm.vm), ['vm-1']);
assert.equal(fallback.summaryMatched, 0);
assert.equal(fallback.summaryFilterFallback, true);
assert.equal(fallback.vms.length, 2);
});
test('buildHostPayloadFromVm attaches credential, tags, transport, and import notes', () => {