Initial
This commit is contained in:
@@ -4,6 +4,7 @@ import assert from 'node:assert/strict';
|
||||
import { load } from './setup.mjs';
|
||||
|
||||
const {
|
||||
buildVmListPath,
|
||||
buildHostPayloadFromVm,
|
||||
filterSummaryVms,
|
||||
normalizeBaseUrl,
|
||||
@@ -64,6 +65,23 @@ test('filterSummaryVms prefilters hostname searches by VM name and falls back wh
|
||||
assert.equal(fallback.vms.length, 2);
|
||||
});
|
||||
|
||||
test('buildVmListPath uses documented exact-name filters for api and rest profiles', () => {
|
||||
const filter = { field: 'name', operator: 'equals', value: 'MCS-WIN-APP01' };
|
||||
|
||||
assert.equal(
|
||||
buildVmListPath({ vmListPath: '/api/vcenter/vm', vmNameParam: 'names' }, filter),
|
||||
'/api/vcenter/vm?names=MCS-WIN-APP01'
|
||||
);
|
||||
assert.equal(
|
||||
buildVmListPath({ vmListPath: '/rest/vcenter/vm', vmNameParam: 'filter.names' }, filter),
|
||||
'/rest/vcenter/vm?filter.names=MCS-WIN-APP01'
|
||||
);
|
||||
assert.equal(
|
||||
buildVmListPath({ vmListPath: '/api/vcenter/vm', vmNameParam: 'names' }, { field: 'name', operator: 'contains', value: 'MCS' }),
|
||||
'/api/vcenter/vm'
|
||||
);
|
||||
});
|
||||
|
||||
test('buildHostPayloadFromVm attaches credential, tags, transport, and import notes', () => {
|
||||
const payload = buildHostPayloadFromVm(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user