This commit is contained in:
2026-06-25 13:35:50 -05:00
parent ff94c0cce5
commit dfc2c9b475
6 changed files with 96 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ import { load } from './setup.mjs';
const {
buildHostPayloadFromVm,
filterSummaryVms,
normalizeBaseUrl,
normalizeVCenterVm,
vmMatchesFilter
@@ -37,6 +38,17 @@ test('vmMatchesFilter supports hostname contains and IP equals matching', () =>
assert.equal(vmMatchesFilter(candidate, { field: 'fqdn', operator: 'startsWith', value: 'db' }), false);
});
test('filterSummaryVms scans the full VM summary list for VM-name filters', () => {
const vms = [
...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' });
assert.equal(matched.length, 1);
assert.equal(matched[0].name, 'MCS-WIN-APP01');
});
test('buildHostPayloadFromVm attaches credential, tags, transport, and import notes', () => {
const payload = buildHostPayloadFromVm(
{