chore:保留test
This commit is contained in:
@@ -41,6 +41,7 @@ const DOC_URLS = [
|
|||||||
'/card/api/card/lists',
|
'/card/api/card/lists',
|
||||||
'/card/api/card/detail',
|
'/card/api/card/detail',
|
||||||
'/card/api/card/update',
|
'/card/api/card/update',
|
||||||
|
'/card/api/card/toggleFavorite', // 收藏(双向 toggle, 后端 2.9.12)
|
||||||
'/card/api/card/create', // 后端源码已有(新建数字名片), 旧文档未列, 以源码为准
|
'/card/api/card/create', // 后端源码已有(新建数字名片), 旧文档未列, 以源码为准
|
||||||
'/card/api/card/claim',
|
'/card/api/card/claim',
|
||||||
'/card/api/card/recognize',
|
'/card/api/card/recognize',
|
||||||
@@ -73,6 +74,7 @@ const HELPER_URL_PAIRS = [
|
|||||||
['cardLists', 'CARD_LISTS'],
|
['cardLists', 'CARD_LISTS'],
|
||||||
['cardDetail', 'CARD_DETAIL'],
|
['cardDetail', 'CARD_DETAIL'],
|
||||||
['cardUpdate', 'CARD_UPDATE'],
|
['cardUpdate', 'CARD_UPDATE'],
|
||||||
|
['cardToggleFavorite', 'CARD_FAVORITE'],
|
||||||
['cardCreate', 'CARD_CREATE'],
|
['cardCreate', 'CARD_CREATE'],
|
||||||
['cardClaim', 'CARD_CLAIM'],
|
['cardClaim', 'CARD_CLAIM'],
|
||||||
['cardRecognize', 'CARD_RECOGNIZE'],
|
['cardRecognize', 'CARD_RECOGNIZE'],
|
||||||
@@ -98,7 +100,7 @@ const HELPER_URL_PAIRS = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
// 文档 3.3/4.2/4.4/3.7: 嵌套对象/数组入参必须走 JSON body(sendJson)
|
// 文档 3.3/4.2/4.4/3.7: 嵌套对象/数组入参必须走 JSON body(sendJson)
|
||||||
const JSON_BODY_HELPERS = ['cardUpdate', 'cardCreate', 'contactAdd', 'contactUpdate', 'cardRecognizeBatch', 'exchangeAgree', 'exchangeIgnore', 'cardDesignSave'];
|
const JSON_BODY_HELPERS = ['cardUpdate', 'cardCreate', 'cardToggleFavorite', 'contactAdd', 'contactUpdate', 'cardRecognizeBatch', 'exchangeAgree', 'exchangeIgnore', 'cardDesignSave'];
|
||||||
|
|
||||||
// =============================================================
|
// =============================================================
|
||||||
// 1. 端点与后端文档逐一比对
|
// 1. 端点与后端文档逐一比对
|
||||||
@@ -126,7 +128,7 @@ test('收口: 15 个端点均有对应 helper 方法', () => {
|
|||||||
for (const [helper, urlConst] of HELPER_URL_PAIRS) {
|
for (const [helper, urlConst] of HELPER_URL_PAIRS) {
|
||||||
assert.ok(new RegExp(`\\b${helper}\\(p\\)\\s*\\{`).test(API_SRC),
|
assert.ok(new RegExp(`\\b${helper}\\(p\\)\\s*\\{`).test(API_SRC),
|
||||||
`缺少 helper ${helper}(p)`);
|
`缺少 helper ${helper}(p)`);
|
||||||
assert.ok(new RegExp(`url:\\s*CARD_API_URL\\.${urlConst}\\b`).test(API_SRC),
|
assert.ok(new RegExp(`(?:url\\s*:|url\\s*=)\\s*CARD_API_URL\\.${urlConst}\\b`).test(API_SRC),
|
||||||
`helper ${helper} 未绑定 ${urlConst}`);
|
`helper ${helper} 未绑定 ${urlConst}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user