匹配测试/结构化规则补读商家编码,诊断日志标出缺失字段;订单/任务/工单关键词支持带连字符的 PDD order_sn 走索引快路径。 Co-authored-by: Cursor <cursoragent@cursor.com>
23 lines
924 B
TypeScript
23 lines
924 B
TypeScript
import assert from 'node:assert/strict'
|
|
import test from 'node:test'
|
|
|
|
import { isPlatformOrderIdLookupKeyword } from './platform-order-id.js'
|
|
|
|
test('识别纯数字平台订单号', () => {
|
|
assert.equal(isPlatformOrderIdLookupKeyword('20247230034021572'), true)
|
|
assert.equal(isPlatformOrderIdLookupKeyword('123456'), true)
|
|
assert.equal(isPlatformOrderIdLookupKeyword('12345'), false)
|
|
})
|
|
|
|
test('识别拼多多带连字符的 order_sn', () => {
|
|
assert.equal(isPlatformOrderIdLookupKeyword('260915-091435834962130'), true)
|
|
assert.equal(isPlatformOrderIdLookupKeyword('260912-123456789012345'), true)
|
|
})
|
|
|
|
test('拒绝普通关键词', () => {
|
|
assert.equal(isPlatformOrderIdLookupKeyword('皮肤店'), false)
|
|
assert.equal(isPlatformOrderIdLookupKeyword('安卓怒嚎3钻'), false)
|
|
assert.equal(isPlatformOrderIdLookupKeyword('DT881aa66294cc'), false)
|
|
assert.equal(isPlatformOrderIdLookupKeyword(''), false)
|
|
})
|