优化
This commit is contained in:
@@ -5,6 +5,28 @@ import test from 'node:test'
|
||||
import { run, vehicleCapacityMatches } from './phase4-overseas-master-data.mjs'
|
||||
import { run as runCare } from './fleet-vehicle-care.mjs'
|
||||
|
||||
test('平台用户手机号已存在只换号重试,未知创建结果不得重发', async () => {
|
||||
for (const collision of [true, false]) {
|
||||
const { context } = fakeContext({ softAssertions: true })
|
||||
const original = context.request.bind(context)
|
||||
const phones = []
|
||||
let sequence = 0
|
||||
context.findAvailablePhone = async () => `1380000${String(++sequence).padStart(4, '0')}`
|
||||
context.request = async (method, path, body, ...rest) => {
|
||||
if (method === 'POST' && path === '/api/platform/v1/iam/users') {
|
||||
phones.push(body.phone)
|
||||
if (phones.length === 1) return collision
|
||||
? {http:200,body:{code:'A0409',message:'手机号已存在'}}
|
||||
: {http:500,body:{code:'S0500'}}
|
||||
}
|
||||
return original(method,path,body,...rest)
|
||||
}
|
||||
await run(context)
|
||||
assert.equal(phones.length, collision ? 2 : 1)
|
||||
if (collision) assert.notEqual(phones[0],phones[1])
|
||||
}
|
||||
})
|
||||
|
||||
test('运维专项接受NON_NULL真实响应但仍完成全部六类记录和两车停用', async () => {
|
||||
const { context, state } = fakeContext()
|
||||
const request = context.request.bind(context)
|
||||
|
||||
Reference in New Issue
Block a user