Initial
This commit is contained in:
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user