const test = require('node:test'); const assert = require('node:assert/strict'); const { DEFAULT_BOOTSTRAP_ENDPOINT, normalizeEndpoint, } = require('../src/services/remoteEnrollmentService'); test('remote enrollment defaults to the managed HTTPS endpoint', () => { assert.equal(normalizeEndpoint(''), DEFAULT_BOOTSTRAP_ENDPOINT); assert.equal(normalizeEndpoint('https://ck.yydd.ai:8443/v1/enroll'), 'https://ck.yydd.ai:8443/v1/enroll'); }); test('remote enrollment refuses insecure or credential-bearing endpoints', () => { assert.throws(() => normalizeEndpoint('http://ck.yydd.ai/v1/enroll'), /HTTPS/u); assert.throws(() => normalizeEndpoint('https://user:secret@ck.yydd.ai/v1/enroll'), /HTTPS/u); });