| | |
| | | // 隔离库复原旧07快照形状:普通读写不补来源行,明确更新才启用新详情,同时保留旧人工值。 |
| | | const legacy = await api(page, 'splice-report', 'POST', { name: '旧07快照', selections: [selection(9701), selection(9702)], settings: { |
| | | fieldStructure: [{ name: '旧人工字段', displayName: '旧人工字段', category: 'special', unit: '' }], |
| | | detailFieldValues: { 旧人工字段: { '9701|9701': '旧人工保留' } }, sourceExperimentNames: { '9701|9701': '旧实验保留' }, |
| | | detailFieldValues: { 旧人工字段: { '9701|9701': '旧人工保留' } }, sourceExperimentNames: { '9701|9701': '旧实验保留', '9702|9703': '已移除来源残留实验' }, |
| | | } }) |
| | | stack.executeIsolatedSql(`UPDATE t_splice_report_version SET snapshot_json=JSON_REMOVE(snapshot_json,'$.settings.sourceDetailOverrides') WHERE report_id=${legacy.id}`) |
| | | const old = await api(page, `splice-report/${legacy.id}`) |
| | |
| | | const legacyUpdated = await api(page, `splice-report/${legacy.id}/refresh-source`, 'POST', { baseVersionNo: 2, changeSummary: '旧版明确更新' }) |
| | | expect(legacyUpdated.settings.detailFieldValues).toEqual(old.settings.detailFieldValues) |
| | | expect(legacyUpdated.settings.sourceDetailOverrides['9701|9701'].experimentName).toBe('旧实验保留') |
| | | expect(legacyUpdated.settings.sourceDetailOverrides['9702|9703']).toBeUndefined() |
| | | await page.goto(`/report-splice/${legacy.id}/edit?mode=view`) |
| | | await expect(page.locator('.source-detail-section')).toContainText('旧实验保留') |
| | | await expect(page.locator('.source-detail-section')).toContainText('新增内容') |
| | | await expect(page.locator('.report-field-section')).toContainText('旧人工保留') |
| | | expect(await api(page, `splice-report/${legacy.id}/versions/1`)).toEqual(old) |
| | | expect((await api(page, `splice-report/${legacy.id}/versions/1`)).settings.sourceExperimentNames).toEqual({ '9701|9701': '旧实验保留', '9702|9703': '已移除来源残留实验' }) |
| | | expect(templateId).toBeGreaterThan(0) |
| | | expect(errors).toEqual([]) |
| | | }) |