fix(产品): 防止空概览覆盖版本树

This commit is contained in:
Script Generator
2026-06-30 15:21:44 +08:00
parent b365ce65a3
commit f82ec1ea6f
2 changed files with 64 additions and 3 deletions

View File

@@ -7,6 +7,35 @@ test('does not persist an empty remote overview', () => {
assert.equal(shouldPersistRemoteOverview([]), false);
});
test('persists a non-empty remote overview', () => {
assert.equal(shouldPersistRemoteOverview([{ id: 'product-1' }]), true);
test('does not persist product-only remote overview', () => {
assert.equal(shouldPersistRemoteOverview([{ id: 'product-1' }]), false);
});
test('does not persist relational products without frontend project or version data', () => {
assert.equal(
shouldPersistRemoteOverview([
{
id: 'cmqs07s3900001450gwu9lesi',
name: '测试AI任务拆解',
projects: [],
versions: [],
_count: { requirements: 0, projects: 0, versions: 0 },
},
]),
false,
);
});
test('persists overview with frontend project and version ids', () => {
assert.equal(
shouldPersistRemoteOverview([
{
id: 'local-1782301366735',
name: '测试AI任务拆解',
projects: [{ id: 'proj-1782301375710', name: '任务拆解' }],
versions: [{ id: 'ver-1782301431670', name: '任务拆解V1.0', status: 'developing' }],
},
]),
true,
);
});