This commit is contained in:
parent
3ee4593e9f
commit
4d3d46c96e
@ -83,7 +83,8 @@ test('部署和启动必须完整构建、验证产物且不覆盖运行配置',
|
|||||||
const start = await read('deploy/start-dev.ps1')
|
const start = await read('deploy/start-dev.ps1')
|
||||||
assert.ok(deploy.indexOf("'build.ps1'") < deploy.indexOf('Copy-Item'))
|
assert.ok(deploy.indexOf("'build.ps1'") < deploy.indexOf('Copy-Item'))
|
||||||
assert.match(deploy, /verify --deployed/)
|
assert.match(deploy, /verify --deployed/)
|
||||||
assert.match(deploy, /deployment-history/)
|
assert.doesNotMatch(deploy, /deployment-history/)
|
||||||
|
assert.match(deploy, /Remove-Item -LiteralPath \$item\.FullName -Recurse -Force/)
|
||||||
assert.doesNotMatch(deploy, /Copy-Item[^\n]*(config|data|ssl)/)
|
assert.doesNotMatch(deploy, /Copy-Item[^\n]*(config|data|ssl)/)
|
||||||
assert.doesNotMatch(start, /SkipBuild|SkipFrontend/)
|
assert.doesNotMatch(start, /SkipBuild|SkipFrontend/)
|
||||||
assert.match(start, /\$env:SMAIL_ROOT = \$runtime/)
|
assert.match(start, /\$env:SMAIL_ROOT = \$runtime/)
|
||||||
|
|||||||
@ -16,19 +16,38 @@ const createPage = compileFunction(
|
|||||||
function fixture(tlsMode, type = '2') {
|
function fixture(tlsMode, type = '2') {
|
||||||
const requests = []
|
const requests = []
|
||||||
const messages = []
|
const messages = []
|
||||||
const window = { location: { href: 'https://mail.example.test/setup' } }
|
let scheduledTimer = null
|
||||||
|
const window = {
|
||||||
|
location: { href: 'https://mail.example.test/setup' },
|
||||||
|
setTimeout: callback => {
|
||||||
|
scheduledTimer = callback
|
||||||
|
return 1
|
||||||
|
},
|
||||||
|
clearTimeout: () => {
|
||||||
|
scheduledTimer = null
|
||||||
|
}
|
||||||
|
}
|
||||||
const page = createPage(computed, () => {}, reactive, ref,
|
const page = createPage(computed, () => {}, reactive, ref,
|
||||||
{ error: message => messages.push(message) }, {}, {}, {}, {
|
{ error: message => messages.push(message) }, {}, {}, {}, {
|
||||||
post: async (path, payload) => {
|
post: async (path, payload) => {
|
||||||
requests.push({ path, payload })
|
requests.push({ path, payload })
|
||||||
return { errorNo: 0, data: { tlsMode, type, port: 8080 } }
|
return { errorNo: 0, data: { tlsMode, type, port: 8080 } }
|
||||||
}
|
}
|
||||||
}, () => 'https://mail.example.test/', () => assert.fail('外部证书不应探测签发状态'), window)
|
}, () => 'https://mail.example.test/', () => true, window)
|
||||||
return { page, requests, messages, window }
|
return {
|
||||||
|
page,
|
||||||
|
requests,
|
||||||
|
messages,
|
||||||
|
window,
|
||||||
|
runScheduledTimer: async () => {
|
||||||
|
scheduledTimer = null
|
||||||
|
await page.checkStatus()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
test('反代初始化强制导入外部证书,即使旧配置仍是自动 DNS 类型', async () => {
|
test('反代初始化强制导入外部证书,即使旧配置仍是自动 DNS 类型', async () => {
|
||||||
const { page, requests, messages, window } = fixture('proxy')
|
const { page, requests, messages, window, runScheduledTimer } = fixture('proxy')
|
||||||
await page.getSSLConfig()
|
await page.getSSLConfig()
|
||||||
assert.equal(page.proxyHTTPS.value, true)
|
assert.equal(page.proxyHTTPS.value, true)
|
||||||
assert.equal(page.sslSettings.type, '1')
|
assert.equal(page.sslSettings.type, '1')
|
||||||
@ -51,6 +70,7 @@ test('反代初始化强制导入外部证书,即使旧配置仍是自动 DNS
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
assert.equal(requests.length, 2)
|
assert.equal(requests.length, 2)
|
||||||
|
await runScheduledTimer()
|
||||||
assert.equal(window.location.href, 'https://mail.example.test/')
|
assert.equal(window.location.href, 'https://mail.example.test/')
|
||||||
assert.deepEqual(messages, [])
|
assert.deepEqual(messages, [])
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user