import {test} from "node:test" import assert from "node:assert/strict" import {readProbeSource} from "./probe-source" test("Preview принимает только IPv4 текущего host, null остаётся неизвестностью",()=>{assert.equal(readProbeSource({host:"router.test",ipv4:"192.0.2.1"},"router.test"),"192.0.2.1");assert.equal(readProbeSource({host:"router.test",ipv4:null},"router.test"),null);for(const raw of [{ipv4:"192.0.2.1"},{host:"other.test",ipv4:"192.0.2.1"},{host:"router.test",ipv4:"999.0.0.1"},{host:"router.test",ipv4:"192.000.2.1"},{host:"router.test",ipv4:"::1"},{}])assert.throws(()=>readProbeSource(raw,"router.test"))})