fix(acceptance): reuse configured merchant credentials
This commit is contained in:
@@ -48,8 +48,8 @@ test('customer confirms chargeable quantity and manual unit price in one locked
|
|||||||
const source = await readFile(moduleFile, 'utf8')
|
const source = await readFile(moduleFile, 'utf8')
|
||||||
assert.match(source, /const orderId = id\(fixture\?\.orderId\)/)
|
assert.match(source, /const orderId = id\(fixture\?\.orderId\)/)
|
||||||
assert.match(source, /context\.context\?\.merchantQualificationFixture/)
|
assert.match(source, /context\.context\?\.merchantQualificationFixture/)
|
||||||
assert.match(source, /merchantFixture\?\.username/)
|
assert.match(source, /merchantFixture\?\.username \|\| MERCHANT_USERNAME/)
|
||||||
assert.match(source, /merchantFixture\?\.password/)
|
assert.match(source, /merchantFixture\?\.password \|\| MERCHANT_PASSWORD/)
|
||||||
assert.doesNotMatch(source, /const orderId = id\(context\.createdResources\.orders\?\.orderId\)/)
|
assert.doesNotMatch(source, /const orderId = id\(context\.createdResources\.orders\?\.orderId\)/)
|
||||||
assert.match(source, /Client 读取已推送计费量、对客单价和费用合计/)
|
assert.match(source, /Client 读取已推送计费量、对客单价和费用合计/)
|
||||||
assert.match(source, /Client 一次确认计费量、对客单价和费用/)
|
assert.match(source, /Client 一次确认计费量、对客单价和费用/)
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
const MODULE = 'inbound-fees'
|
const MODULE = 'inbound-fees'
|
||||||
const OPTIONS = { scenario: 'inbound-fee-lifecycle', deploymentBlocker: true }
|
const OPTIONS = { scenario: 'inbound-fee-lifecycle', deploymentBlocker: true }
|
||||||
|
const MERCHANT_USERNAME = process.env.MERCHANT_TEST_USERNAME || ''
|
||||||
|
const MERCHANT_PASSWORD = process.env.MERCHANT_TEST_PASSWORD || ''
|
||||||
|
|
||||||
function id(value) { return value === null || value === undefined ? '' : String(value) }
|
function id(value) { return value === null || value === undefined ? '' : String(value) }
|
||||||
function success(response) { return response?.http === 200 && String(response?.body?.code) === '200' }
|
function success(response) { return response?.http === 200 && String(response?.body?.code) === '200' }
|
||||||
@@ -134,7 +136,8 @@ export async function run(context) {
|
|||||||
const orderId = id(fixture?.orderId)
|
const orderId = id(fixture?.orderId)
|
||||||
const merchantFixture = context.context?.merchantQualificationFixture
|
const merchantFixture = context.context?.merchantQualificationFixture
|
||||||
const merchantLoginResponse = await context.request('POST', '/api/auth/login', {
|
const merchantLoginResponse = await context.request('POST', '/api/auth/login', {
|
||||||
loginId: merchantFixture?.username, password: merchantFixture?.password,
|
loginId: merchantFixture?.username || MERCHANT_USERNAME,
|
||||||
|
password: merchantFixture?.password || MERCHANT_PASSWORD,
|
||||||
}, '')
|
}, '')
|
||||||
const merchantLogin = context.apiSuccess(MODULE, 'Client 登录并准备确认计费量和费用', merchantLoginResponse,
|
const merchantLogin = context.apiSuccess(MODULE, 'Client 登录并准备确认计费量和费用', merchantLoginResponse,
|
||||||
`orderId=${orderId || 'missing'}`, OPTIONS)
|
`orderId=${orderId || 'missing'}`, OPTIONS)
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ function markerOwnedContext() {
|
|||||||
if (body.actualAt != null
|
if (body.actualAt != null
|
||||||
&& NODE_SEQUENCES[body.standardNode] <= NODE_SEQUENCES[task.latestActualNode]) {
|
&& NODE_SEQUENCES[body.standardNode] <= NODE_SEQUENCES[task.latestActualNode]) {
|
||||||
return conflict(`req-monotonic-${key}`,
|
return conflict(`req-monotonic-${key}`,
|
||||||
`人工实际节点必须严格晚于当前最新实际节点:${task.latestActualNode}`)
|
'实际船节点必须按业务顺序向后推进')
|
||||||
}
|
}
|
||||||
const providerEventId = `manual-${String(nextId)}`
|
const providerEventId = `manual-${String(nextId)}`
|
||||||
nodes.push({
|
nodes.push({
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ function codeOf(response) { return response?.body?.code == null ? 'missing' : St
|
|||||||
function rejected(response) { return response?.http === 200 && ['A0409', '409'].includes(codeOf(response)) }
|
function rejected(response) { return response?.http === 200 && ['A0409', '409'].includes(codeOf(response)) }
|
||||||
function monotonicRejected(response) {
|
function monotonicRejected(response) {
|
||||||
return rejected(response)
|
return rejected(response)
|
||||||
&& String(response?.body?.message || '').includes('人工实际节点必须严格晚于当前最新实际节点')
|
&& String(response?.body?.message || '').includes('实际船节点必须按业务顺序向后推进')
|
||||||
&& Boolean(response?.requestId) && Boolean(response?.traceId)
|
&& Boolean(response?.requestId) && Boolean(response?.traceId)
|
||||||
}
|
}
|
||||||
function localIso(value) { return value.toISOString().slice(0, 19) }
|
function localIso(value) { return value.toISOString().slice(0, 19) }
|
||||||
|
|||||||
Reference in New Issue
Block a user