Files
order_site/apps/backend/src/utils/platform-order-id.test.ts
T
yml2213andCursor 5cbb977b96 fix(pdd): 匹配诊断对齐 out_sku_sn,并加速拼多多订单号搜索
匹配测试/结构化规则补读商家编码,诊断日志标出缺失字段;订单/任务/工单关键词支持带连字符的 PDD order_sn 走索引快路径。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 10:45:53 +08:00

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)
})