test: 优化dns测试用例 2

release-2.0.0.2
王良 2025-03-11 11:25:29 +08:00
parent d52b65618a
commit 46024e5c4d
2 changed files with 9 additions and 1 deletions

View File

@ -14,7 +14,7 @@ function parseVersion (version) {
* @param log 日志对象
* @returns {number} 比较线上版本号是否为更新的版本大于0=|0=相等|小于0=|-999=出现异常比较结果未知
*/
export function isNewVersion (onlineVersion, currentVersion, log = console) {
export function isNewVersion (onlineVersion, currentVersion, log = null) {
if (onlineVersion === currentVersion) {
return 0
}

View File

@ -111,6 +111,14 @@ console.log('\n--------------- test ForSNI ---------------\n')
console.log(`===> test ForSNI: ${dnsProviders.ForSNI.dnsName}`, '\n\n')
assert.strictEqual(dnsProviders.ForSNI, dnsProviders.safe360)
const dnsProviders2 = dns.initDNS({
aliyun: {
server: 'udp://223.5.5.5',
},
}, {})
console.log(`===> test ForSNI2: ${dnsProviders2.ForSNI.dnsName}`, '\n\n')
assert.strictEqual(dnsProviders2.ForSNI, dnsProviders2.PreSet) // 未配置forSNI的DNS时默认使用PreSet作为ForSNI
console.log('\n--------------- test PreSet ---------------\n')
ip = await dnsProviders.PreSet.lookup(hasPresetHostname)