优化
This commit is contained in:
@@ -6,11 +6,14 @@ import { PRODUCT_CATALOG, buildOrderPayload, diversifyRoutes, parseArguments, ra
|
||||
|
||||
const source = readFileSync(new URL('./create-pending-review-orders.mjs', import.meta.url), 'utf8')
|
||||
|
||||
test('uses the fixed merchant account and stops at pending review', () => {
|
||||
assert.ok(source.includes("USERNAME: '17512095155'"), 'fixed username is missing')
|
||||
assert.ok(/PASSWORD:\s*'[^']*'/.test(source), 'CONFIG.PASSWORD is missing')
|
||||
assert.ok(/COUNT:\s*\d+/.test(source), 'CONFIG.COUNT is missing')
|
||||
assert.match(source, /COUNT:\s*50/)
|
||||
test('uses the configured merchant account and stops at pending review', () => {
|
||||
assert.match(source, /process\.env\.ADMIN_TEST_GATEWAY/)
|
||||
assert.match(source, /process\.env\.MERCHANT_TEST_USERNAME/)
|
||||
assert.match(source, /process\.env\.MERCHANT_TEST_PASSWORD/)
|
||||
assert.match(source, /const DEFAULT_COUNT = 50/)
|
||||
assert.doesNotMatch(source, /const CONFIG\s*=/)
|
||||
assert.doesNotMatch(source, /8\.163\.30\.128/)
|
||||
assert.doesNotMatch(source, /PASSWORD:\s*'[^']+'/)
|
||||
assert.match(source, /randomInt\(1, 31\)/)
|
||||
assert.match(source, /loadPricedRoutes/)
|
||||
assert.match(source, /destinationWarehouseCode/)
|
||||
@@ -28,6 +31,7 @@ test('uses the fixed merchant account and stops at pending review', () => {
|
||||
})
|
||||
|
||||
test('supports a bounded fixed order count', () => {
|
||||
assert.equal(validateCount(undefined), 50)
|
||||
assert.equal(validateCount('1'), 1)
|
||||
assert.equal(validateCount('10'), 10)
|
||||
assert.throws(() => validateCount('0'), /between 1 and 100/)
|
||||
|
||||
Reference in New Issue
Block a user