Files
pda-overseas-uniapp/tests/deployment.test.mjs
T

24 lines
1.1 KiB
JavaScript

import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
const pipeline = readFileSync(new URL('../Jenkinsfile', import.meta.url), 'utf8')
test('test H5 deployment validates the exact overseas PDA site root', () => {
assert.match(pipeline, /TEST_SITE_ROOT = '\/www\/wwwroot\/test-pda-global\.buggoglobal\.com'/)
assert.match(pipeline, /test "\$target" = '\/www\/wwwroot\/test-pda-global\.buggoglobal\.com'/)
})
test('test H5 deployment replaces only generated assets and keeps host files', () => {
assert.match(pipeline, /for entry in index\.html assets static/)
assert.doesNotMatch(pipeline, /rm -rf "?\$target"?\/\*/)
for (const preserved of ['.well-known', '.user.ini', '.htaccess', '404.html']) {
assert.doesNotMatch(pipeline, new RegExp(`rm -rf [^\\n]*${preserved.replace('.', '\\.')}`))
}
})
test('test H5 deployment runs tests and asserts the neutral empty-result copy before publishing', () => {
assert.match(pipeline, /npm ci && npm test && npm run build:h5/)
assert.match(pipeline, /当前绑定仓没有匹配的待签收或签收中退货单/)
})