Analyse: Services-Route faellt bei Fehler der Analyse-Abfrage nicht aus
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0b59dac2be
commit
2ca18f9c65
2 files changed
+25
-5
No files matched your search
@@ -43,11 +43,17 @@ router.get('/', async (_req, res) => {
|
||||
loadByIds(config.collections.workorders, projects.map((p) => p.ticketId)),
|
||||
])
|
||||
|
||||
const analyseDocs = await listDocuments(config.collections.portalFeatures, [
|
||||
Query.equal('featureKey', 'analyse'),
|
||||
Query.limit(5000),
|
||||
])
|
||||
const analyseState = new Map((analyseDocs || []).map((d) => [d.projectId, d.state || 'off']))
|
||||
// Ein Fehler hier darf die Services-Seite nicht kosten: dann ohne Analyse-Zustand
|
||||
let analyseState = new Map()
|
||||
try {
|
||||
const analyseDocs = await listDocuments(config.collections.portalFeatures, [
|
||||
Query.equal('featureKey', 'analyse'),
|
||||
Query.limit(5000),
|
||||
])
|
||||
analyseState = new Map((analyseDocs || []).map((d) => [d.projectId, d.state || 'off']))
|
||||
} catch (err) {
|
||||
console.warn('[admin-services] Analyse-Zustände nicht geladen:', err.message)
|
||||
}
|
||||
|
||||
const groups = {}
|
||||
for (const p of projects) {
|
||||
|
||||
@@ -80,3 +80,17 @@ test('Analyse: features.analyse je Projekt, Katalogstatus folgt ANALYSE_ENABLED'
|
||||
const { FEATURES } = await import('../server/services/projectKinds.js')
|
||||
assert.equal(FEATURES.analyse.status, 'in_development')
|
||||
})
|
||||
|
||||
test('Analyse-Abfrage scheitert => 200, features.analyse null', async () => {
|
||||
aw.failNext({ method: 'GET', pathIncludes: '/portalFeatures/', status: 500 })
|
||||
const warn = console.warn
|
||||
console.warn = () => {}
|
||||
try {
|
||||
const r = await get('jwt-admin')
|
||||
assert.equal(r.status, 200)
|
||||
const body = await r.json()
|
||||
assert.equal(body.groups.website[0].features.analyse, null)
|
||||
} finally {
|
||||
console.warn = warn
|
||||
}
|
||||
})
|
||||
Reference in new issue
Block a user