Öffnungszeiten: Neubau anstoßen und Feld im Runner-Auftrag
buildZeiten (einbau.js) liefert dem Runner-Auftrag { siteKey } bei Funktion in setup/active,
null bei Sperrliste und Fehlern. stosseNeubauAn (neubau.js) stößt den Neubau unter der
Sperre zeiten-neubau an und meldet angestossen oder manuell.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0042d8dd8f
commit
302b58cf72
5 files changed
+279
-2
No files matched your search
@@ -112,7 +112,7 @@ test('an: Auftrag mit entschlüsselten Variablen, sofortige Rückgabe, Ergebnis
|
||||
assert.equal(aw.get('websiteProjects', id).previewState, 'building')
|
||||
const [sub] = submits()
|
||||
assert.equal(sub.auth, 'Bearer sekret')
|
||||
assert.deepEqual(sub.body, { sub: repo.split('/')[1], repo, sha: SHA, branch: 'main', mode: 'auto', displayName: 'Mein Projekt', env: { API_URL: 'https://x.test' }, analytics: null })
|
||||
assert.deepEqual(sub.body, { sub: repo.split('/')[1], repo, sha: SHA, branch: 'main', mode: 'auto', displayName: 'Mein Projekt', env: { API_URL: 'https://x.test' }, analytics: null, zeiten: null })
|
||||
await pd.waitForRunFollowers()
|
||||
const d = aw.get('websiteProjects', id)
|
||||
assert.equal(d.previewState, 'online')
|
||||
@@ -449,6 +449,55 @@ test('Analyse: Dev-PUT nach erfolgreichem Build (Modus dev) enthält kein analyt
|
||||
for (const c of puts) assert.equal('analytics' in c.body, false)
|
||||
})
|
||||
|
||||
// ---- Zeiten-Feld im Build-Auftrag (Oeffnungszeiten live, Spec 4.6) ----
|
||||
async function zeitenProject({ state = 'active', project: pextra = {}, noFeature = false } = {}) {
|
||||
const { createDocument } = await import('../server/services/appwriteAdmin.js')
|
||||
const cid = `cust-ze-${n + 1}`
|
||||
const p = await project({ customerId: cid, subdomain: `ze-${n + 1}`, ...pextra })
|
||||
if (!noFeature) {
|
||||
await createDocument('portalFeatures', { customerId: cid, projectId: p.id, featureKey: 'zeiten', state, enabled: state === 'active', siteKey: 'abcdefghijklmnop' }, `f_${p.id}_zeiten`)
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
test('Zeiten: setup und active ⇒ zeiten mit siteKey, auch ohne isPublic', async () => {
|
||||
for (const state of ['setup', 'active']) {
|
||||
assert.deepEqual((await submitFor(await zeitenProject({ state }))).zeiten, { siteKey: 'abcdefghijklmnop' }, state)
|
||||
}
|
||||
})
|
||||
|
||||
test('Zeiten: off, ordered, disabled und ohne Funktion ⇒ null', async () => {
|
||||
for (const state of ['off', 'ordered', 'disabled']) {
|
||||
assert.equal((await submitFor(await zeitenProject({ state }))).zeiten, null, state)
|
||||
}
|
||||
assert.equal((await submitFor(await zeitenProject({ noFeature: true }))).zeiten, null)
|
||||
})
|
||||
|
||||
test('Zeiten: Sperrliste ⇒ null, Analyse bleibt unberührt', async () => {
|
||||
const body = await submitFor(await zeitenProject({ project: { subdomain: 'emmas-schatzkiste' } }))
|
||||
assert.equal(body.zeiten, null)
|
||||
assert.equal(body.analytics, null)
|
||||
})
|
||||
|
||||
test('Zeiten: Fehler bei der Funktions-Abfrage ⇒ null, Auftrag wird trotzdem gesendet', async (t) => {
|
||||
t.mock.method(console, 'warn', () => {})
|
||||
const p = await zeitenProject()
|
||||
aw.failNext({ method: 'GET', pathIncludes: 'portalFeatures', status: 500 })
|
||||
const before = submits().length
|
||||
const body = await submitFor(p)
|
||||
assert.equal(submits().length, before + 1)
|
||||
assert.equal(body.zeiten, null)
|
||||
})
|
||||
|
||||
test('Zeiten: Dev-PUT nach erfolgreichem Build (Modus dev) enthält kein zeiten', async () => {
|
||||
rs.script = done({ result: 'dev' })
|
||||
const body = await submitFor(await zeitenProject({ project: { previewMode: 'dev' } }))
|
||||
assert.deepEqual(body.zeiten, { siteKey: 'abcdefghijklmnop' })
|
||||
const puts = rs.calls.filter((c) => c.method === 'PUT' && c.url.startsWith('/dev/'))
|
||||
assert.ok(puts.length >= 1)
|
||||
for (const c of puts) assert.equal('zeiten' in c.body, false)
|
||||
})
|
||||
|
||||
test('Analyse: überlange Angaben, Steuerzeichen, schlechte Farbe ⇒ Grenzen eingehalten, Auftrag geht raus', async (t) => {
|
||||
t.mock.method(console, 'warn', () => {})
|
||||
const p = await analyseProject({
|
||||
|
||||
Reference in new issue
Block a user