feat(edit): 编辑页开发
This commit is contained in:
@@ -7,6 +7,7 @@ import { afterAll, beforeAll, describe, it } from 'vitest';
|
||||
import { DATABASE } from '../src/database/database.module.js';
|
||||
import { createApplication } from '../src/main.js';
|
||||
import { OutboxDispatcher } from '../../worker/src/outbox-dispatcher.js';
|
||||
import { flattenCategories } from '../../worker/src/ozon-catalog-sync.js';
|
||||
import { scheduleStoreCategoryTreeSync } from '../../worker/src/store-category-tree-scheduler.js';
|
||||
|
||||
let app: NestExpressApplication;
|
||||
@@ -42,6 +43,56 @@ async function scheduleWithStoreLock() {
|
||||
}
|
||||
|
||||
describe('门店类目树 Worker 调度集成测试', () => {
|
||||
it('类型叶子继承父类目 ID,并使用 type_name 作为可选项名称', () => {
|
||||
const records = flattenCategories([
|
||||
{
|
||||
description_category_id: 17027495,
|
||||
category_name: '汽车用品',
|
||||
disabled: false,
|
||||
children: [
|
||||
{
|
||||
description_category_id: 17028750,
|
||||
category_name: '汽车脚垫和车座套',
|
||||
disabled: false,
|
||||
children: [
|
||||
{
|
||||
type_name: '汽车罩',
|
||||
type_id: 93587,
|
||||
disabled: false,
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
assert.deepEqual(
|
||||
records.map((record) => ({
|
||||
category: record.external_category_id,
|
||||
type: record.external_type_id,
|
||||
name: record.name,
|
||||
path: record.path,
|
||||
parent: record.parent_key,
|
||||
active: record.is_active,
|
||||
})),
|
||||
[
|
||||
{
|
||||
category: '17027495', type: '0', name: '汽车用品', path: '汽车用品',
|
||||
parent: null, active: false,
|
||||
},
|
||||
{
|
||||
category: '17028750', type: '0', name: '汽车脚垫和车座套',
|
||||
path: '汽车用品 › 汽车脚垫和车座套', parent: '17027495:0', active: false,
|
||||
},
|
||||
{
|
||||
category: '17028750', type: '93587', name: '汽车罩',
|
||||
path: '汽车用品 › 汽车脚垫和车座套 › 汽车罩', parent: '17028750:0', active: true,
|
||||
},
|
||||
],
|
||||
);
|
||||
});
|
||||
|
||||
beforeAll(async () => {
|
||||
Object.assign(process.env, {
|
||||
NODE_ENV: 'test',
|
||||
|
||||
Reference in New Issue
Block a user